circadian.el
circadian.el copied to clipboard
circadian-setup is very heavy
When I execute (circadian-setup), Emacs is suspended a few minutes, lot of I/O. (why circadian-setup has heavy I/O?)
So I take a profiling with Emacs profiler:
CPU profiler report
- timer-event-handler 103854 70%
- apply 103846 70%
- circadian-enable-theme 103772 70%
- load-theme 53783 36%
- apply 53783 36%
- #<compiled 0x2267db> 53783 36%
- enable-theme 53707 36%
- apply 53707 36%
- ad-Advice-enable-theme 53707 36%
- #<compiled 0x226a5f> 53703 36%
- custom-theme-recalc-face 53690 36%
- face-spec-recalc 53553 36%
- face-spec-set-2 48746 32%
- apply 48733 32%
- set-face-attribute 48638 32%
- internal-set-lisp-face-attribute 47961 32%
- frame-set-background-mode 47876 32%
- face-attr-match-p 23974 16%
face-attribute 23078 15%
- face-spec-recalc 23150 15%
- face-spec-reset-face 20658 13%
- apply 20639 13%
set-face-attribute 19378 13%
- face-spec-set-2 1954 1%
- apply 1918 1%
set-face-attribute 1672 1%
+ face-spec-choose 158 0%
+ face-spec-choose 167 0%
+ face-list 37 0%
+ face-spec-reset-face 4555 3%
+ face-spec-choose 101 0%
facep 91 0%
+ eval-buffer 64 0%
+ insert-file-contents 6 0%
#<compiled 0x22688b> 3 0%
- mapc 49937 33%
- disable-theme 49937 33%
- apply 49937 33%
- ad-Advice-disable-theme 49937 33%
- #<compiled 0x226b77> 49931 33%
- face-set-after-frame-default 27319 18%
- face-spec-recalc 23514 15%
- face-spec-reset-face 20963 14%
- apply 20922 14%
set-face-attribute 19707 13%
- face-spec-set-2 1993 1%
- apply 1933 1%
set-face-attribute 1650 1%
- face-spec-choose 162 0%
+ face-spec-set-match-display 58 0%
+ face-list 19 0%
- set-frame-parameter 22492 15%
- modify-frame-parameters 22226 15%
- frame-set-background-mode 22075 14%
- face-attr-match-p 10966 7%
face-attribute 10505 7%
- face-spec-recalc 10512 7%
- face-spec-reset-face 9309 6%
- apply 9293 6%
set-face-attribute 8870 5%
+ face-spec-set-2 925 0%
+ face-spec-choose 84 0%
+ face-spec-choose 80 0%
face-list 19 0%
color-values 6 0%
+ custom--frame-color-default 12 0%
+ run-hook-with-args 52 0%
+ auto-revert-buffers 14 0%
+ beacon--dec 13 0%
+ save-some-buffers 3 0%
+ timer-activate-when-idle 3 0%
- command-execute 41670 28%
- call-interactively 41670 28%
- funcall-interactively 40939 27%
- eval-expression 38589 26%
- eval 38580 26%
- circadian-setup 38580 26%
- circadian-activate-latest-theme 38551 26%
- circadian-enable-theme 38529 26%
- mapc 36074 24%
- disable-theme 36074 24%
- apply 36074 24%
- ad-Advice-disable-theme 36074 24%
- #<compiled 0x226b77> 36074 24%
- set-frame-parameter 22388 15%
- modify-frame-parameters 22282 15%
- frame-set-background-mode 22105 14%
- face-attr-match-p 10916 7%
face-attribute 10487 7%
- face-spec-recalc 10568 7%
- face-spec-reset-face 9307 6%
- apply 9288 6%
set-face-attribute 8825 5%
+ face-spec-set-2 981 0%
+ face-spec-choose 133 0%
+ face-spec-choose 107 0%
+ face-list 10 0%
- face-set-after-frame-default 13651 9%
- face-spec-recalc 11833 8%
- face-spec-reset-face 10482 7%
- apply 10455 7%
set-face-attribute 9881 6%
- face-spec-set-2 1087 0%
+ apply 1066 0%
+ face-spec-choose 80 0%
+ internal-merge-in-global-face 17 0%
+ face-list 15 0%
+ custom--frame-color-default 10 0%
+ load-theme 2432 1%
+ run-hook-with-args 23 0%
+ circadian-filter-inactivate-themes 22 0%
+ mapc 29 0%
+ counsel-M-x 2340 1%
+ handle-focus-in 10 0%
+ byte-code 731 0%
+ ... 2286 1%
+ redisplay_internal (C function) 33 0%
+ sp--save-pre-command-state 11 0%
global-project-shells-mode-check-buffers 4 0%
Memory profiler report:
- timer-event-handler 55,590,275 52%
- apply 55,535,640 52%
- circadian-enable-theme 54,416,671 51%
- mapc 28,572,095 26%
- disable-theme 28,572,095 26%
- apply 28,572,095 26%
- ad-Advice-disable-theme 28,572,095 26%
- #<compiled 0x226b77> 28,572,095 26%
- face-set-after-frame-default 18,777,534 17%
- face-spec-recalc 17,779,558 16%
- face-spec-reset-face 14,994,446 14%
- apply 14,990,222 14%
- set-face-attribute 23,534 0%
purecopy 9,022 0%
- face-spec-set-2 1,361,184 1%
apply 1,361,184 1%
- face-spec-choose 58,520 0%
face-spec-set-match-display 19,448 0%
face-list 505,824 0%
- set-frame-parameter 9,793,505 9%
- modify-frame-parameters 8,996,117 8%
- frame-set-background-mode 8,926,421 8%
- face-spec-recalc 8,234,773 7%
- face-spec-reset-face 7,101,485 6%
- apply 7,101,485 6%
- set-face-attribute 981,629 0%
purecopy 4,514 0%
- face-spec-set-2 529,056 0%
apply 529,056 0%
+ face-spec-choose 67,784 0%
face-list 545,952 0%
face-attr-match-p 114,048 0%
+ face-spec-choose 27,216 0%
color-values 2,112 0%
- load-theme 25,839,296 24%
- apply 25,839,296 24%
- #<compiled 0x2267db> 25,839,296 24%
- enable-theme 25,549,490 24%
- apply 25,549,490 24%
- ad-Advice-enable-theme 25,549,490 24%
- #<compiled 0x226a5f> 25,539,986 24%
- custom-theme-recalc-face 25,535,762 24%
- face-spec-recalc 25,366,802 23%
- face-spec-set-2 19,467,860 18%
- apply 19,467,860 18%
- set-face-attribute 18,821,588 17%
- internal-set-lisp-face-attribute 17,939,906 16%
- frame-set-background-mode 17,936,738 16%
- face-spec-recalc 16,728,674 15%
- face-spec-reset-face 14,146,706 13%
+ apply 14,146,706 13%
+ face-spec-set-2 1,286,256 1%
+ face-spec-choose 30,624 0%
face-list 963,072 0%
face-attr-match-p 203,808 0%
+ face-spec-choose 35,904 0%
color-values 5,280 0%
+ face-spec-reset-face 5,091,102 4%
+ enable-theme 4,224 0%
+ cider-scale-background-color 1,056 0%
+ insert-file-contents 216,472 0%
+ eval-buffer 46,816 0%
+ #<compiled 0x22688b> 6,336 0%
generate-new-buffer 2,122 0%
custom-theme--load-path 1,684 0%
+ run-hook-with-args 5,280 0%
+ beacon--dec 1,104,656 1%
+ auto-revert-buffers 11,120 0%
jit-lock-context-fontify 2,112 0%
+ save-some-buffers 1,081 0%
+ timer-inc-time 19,008 0%
timer-until 7,558 0%
+ timer-activate-when-idle 4,224 0%
+ timer-activate 3,168 0%
- command-execute 50,308,500 47%
- call-interactively 50,308,500 47%
- funcall-interactively 48,293,474 45%
- counsel-M-x 30,625,261 28%
- ivy-read 29,484,034 27%
- ivy-call 24,273,592 22%
- #<compiled 0x39b9921> 24,273,592 22%
- command-execute 24,273,592 22%
- call-interactively 24,273,592 22%
- funcall-interactively 24,273,576 22%
+ profiler-report 24,273,576 22%
+ read-from-minibuffer 5,004,550 4%
+ ivy--reset-state 200,520 0%
+ require 2,048 0%
counsel--M-x-prompt 2,043 0%
- eval-expression 17,416,317 16%
- eval 17,415,225 16%
- circadian-setup 17,415,225 16%
- circadian-activate-latest-theme 17,278,509 16%
+ circadian-enable-theme 17,152,997 16%
- circadian-filter-inactivate-themes 124,488 0%
- cl-remove-if 124,488 0%
- apply 124,488 0%
- cl-remove 124,488 0%
- #<compiled 0x366f1dd> 124,488 0%
- circadian-match-sun 124,488 0%
- circadian-sunset 62,776 0%
- sunrise-sunset 62,776 0%
- solar-sunrise-sunset-string 62,776 0%
- solar-sunrise-sunset 62,776 0%
+ solar-sunrise-and-sunset 60,648 0%
+ solar-exact-local-noon 1,064 0%
+ solar-sidereal-time 1,064 0%
+ circadian-sunrise 61,712 0%
+ circadian-now-time-string 1,024 0%
+ mapc 136,716 0%
+ prin1 1,092 0%
+ handle-focus-in 251,896 0%
+ byte-code 2,015,026 1%
+ redisplay_internal (C function) 152,136 0%
+ ... 8,188 0%
+ winner-save-old-configurations 4,136 0%
+ yas--post-command-handler 3,360 0%
+ sclang-document-post-command-hook-function 3,156 0%
xselect-convert-to-targets 2,112 0%
+ xselect-convert-to-string 1,048 0%
Thanks for reporting, I'll try to dive deeper into the performance of circadian, as soon as I can
@stardiviner On which platform do you run Emacs? And which version did you use? I can't quite reproduce that memory/CPU consuming behaviour. Profiling (circadian-setup) an my MacBook Air (Late 2010) needs under 1% each 🤔
I'm on Arch Linux, and Emacs version 27 (compiled from latest master branch source code).
I've just had another look at this (sorry for taking so ultra long, haven't actively used/developed this package for a while):
Results from using Emacs-Lisp Profiler:
circadian-setup 1 0.00229 0.00229
also added a test to the test suite using benchmark.el: test/circadian.el-test.el#L117, plesae try to run the test on your system, if this is still a persistant issue.
- macOS Big Sur 11.7
- MacBook Pro (Retina, 15-inch, Mid 2014)
- Emacs 29.0.60 (emacs-plus)