Subject: Re: bug#24091: 24.5; High CPU usage at startup while hidden

From: aiken <[email-masked]>
Date: Thu, 28 Jul 2016 18:43:38 +0100

Noam: I think my settings are fairly standard, but another way to
reproduce the effect of Emacs launching in a workspace that you're not
currently in (which seems to be the main issue) is to add something like
"assign [class="Emacs24"] 9" to your i3 config. (I've tried this and it
does reproduce the high CPU usage.)

Clément: I still get the problem with `emacs -Q`. Some clarification
about the problem: the high CPU usage starts while Emacs is launching on
some other workspace, and stops as soon as I go to that workspace. I
notice that, when I go to the Emacs workspace and see the Emacs window,
Emacs hasn't actually loaded up fully (e.g. it hasn't loaded my
init.el), and it only finishes a lot of its startup once I'm on that
workspace. Anyway, since the problem stops as soon as I look at Emacs,
the only way I know of running profiler-report for this purpose is by
putting it in a command line option: `emacs -Q --eval "(profiler-start
'cpu)"`. So I've done this (see below for the report), but I'm pretty
sure the profiler-start is only getting evaluated after I've moved to
the Emacs workspace, i.e. after the problem has stopped.

[profiler-profile "24.3" cpu #s(hash-table size 65 test equal
rehash-size 1.5 rehash-threshold 0.8 data ([nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil] 61 [and or and redisplay_internal\
\(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil] 4
[completing-read-default completing-read read-extended-command byte-code
call-interactively command-execute nil nil nil nil nil nil nil nil nil
nil] 24 [and or and redisplay_internal\ \(C\ function\)
read-from-minibuffer completing-read-default completing-read
read-extended-command byte-code call-interactively command-execute nil
nil nil nil nil] 3 [read-from-minibuffer completing-read-default
completing-read read-extended-command byte-code call-interactively
command-execute nil nil nil nil nil nil nil nil nil] 37
[completion-basic-try-completion "#<compiled 0x4c2287>" "#<compiled
0x4c267f>" funcall completion--some completion--nth-completion
completion-try-completion completion--do-completion
completion--in-region-1 "#<compiled 0x247e21>" apply "#<compiled
0x4c1a7f>" completion--in-region completion-in-region
minibuffer-complete call-interactively] 5
[completion-pcm--all-completions "#<compiled 0x4c3299>" funcall
completion-pcm--find-all-completions completion-pcm-try-completion
"#<compiled 0x4c2287>" "#<compiled 0x4c2a8f>" funcall completion--some
completion--nth-completion completion-try-completion
completion--do-completion completion--in-region-1 "#<compiled 0x247e21>"
apply "#<compiled 0x4c1a7f>"] 4 [completion-emacs22-try-completion
"#<compiled 0x4c2287>" "#<compiled 0x4c3e97>" funcall completion--some
completion--nth-completion completion-try-completion
completion--do-completion completion--in-region-1 "#<compiled 0x247e21>"
apply "#<compiled 0x4c1a7f>" completion--in-region completion-in-region
minibuffer-complete call-interactively] 4 [sit-for minibuffer-message
completion--message completion--do-completion completion--in-region-1
"#<compiled 0x247e21>" apply "#<compiled 0x4c1a7f>"
completion--in-region completion-in-region minibuffer-complete
call-interactively command-execute read-from-minibuffer
completing-read-default completing-read] 2 [delete-backward-char
call-interactively command-execute read-from-minibuffer
completing-read-default completing-read read-extended-command byte-code
call-interactively command-execute nil nil nil nil nil nil] 1
[profiler-cpu-profile profiler-report-cpu profiler-report
call-interactively command-execute execute-extended-command
call-interactively command-execute nil nil nil nil nil nil nil nil] 14
[Automatic\ GC] 2)) (22426 16956 108810 96000) nil]