When I launch emacsclient or make a new frame it spends ~2s in:
- make-frame 312 42%
- frame-creation-function 311 42%
- apply 311 42%
- #<compiled 0x3edba9> 311 42%
- x-create-frame-with-faces 311 42%
- face-set-after-frame-default 287 39%
+ face-spec-recalc 274 37%
I have 523 faces in frame-face-alist
which explains why it's slow. But they all seem to be from packages I use regularly so I can't just get rid off them.
If I replace face-spec-recalc
with an empty function, the new frame loads instantly so I'm pretty sure that's the culprit.
Is there anything I can do to make new frames load faster?
Maybe load faces lazily or cache them somewhere?
I'd be fine with a hack that meant that I had to restart emacs to pick up new faces.
face-remapping-alist
which is designed to work quickly during the redisplay process. It may be worth exploring ... there is a function that uses theface-remapping-alist
, which is calledface-remap-add-relative
: gnu.org/software/emacs/manual/html_node/elisp/… – lawlist May 14 '20 at 7:17face-remapping-alist
as a default for all buffers, and as a buffer-local for other buffers; i.e.,setq-default
andsetq-local
. Although the docs say to use theface-remap-add-relative
to do the adjustments, I chose to set theface-remapping-alist
directly using those default / local approaches. I primarily use this for certain mode-line custom settings; and, I also use it for how the interactive mini-buffer colorizes the prompt and text when focus is inside or out of the mini-buffer.... – lawlist May 14 '20 at 7:22M-x report-emacs-bug
. I remember suffering from very slow frame creation many years ago with similar symptoms, but what you describe is not normal and should get a proper fix. – Stefan May 14 '20 at 17:31