Timeline for Emacs daemon. First emacslient frame loads reasonably fast. Subsequent emacsclient frames load almost instantaneously. Why?
Current License: CC BY-SA 4.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 30, 2021 at 21:28 | vote | accept | Snelephant | ||
Jun 30, 2021 at 12:35 | comment | added | phils |
"Is there a way to load these features in the daemon rather than when opening files?" -- I added a suggestion to my answer earlier today, which causes org-mode to be enabled in a temporary buffer during start-up, which should in turn cause any org-mode dependencies from mode hooks etc to be loaded at init time, without you having to specify them explicitly.
|
|
Jun 30, 2021 at 10:46 | history | edited | Snelephant | CC BY-SA 4.0 |
added 10 characters in body
|
Jun 30, 2021 at 10:40 | history | edited | Snelephant | CC BY-SA 4.0 |
added 1719 characters in body
|
Jun 30, 2021 at 9:48 | history | edited | Snelephant | CC BY-SA 4.0 |
added 54 characters in body
|
Jun 29, 2021 at 20:06 | history | edited | Drew |
edited tags
|
|
Jun 29, 2021 at 14:13 | comment | added | phils |
Right, so it is all about loading that particular type of file for the first time, and all the libraries which need to be loaded on that account. You say that (require 'org) had no obvious effect, though? (Even if there's more to it, this surprises me... did you actually test it? The output you quoted isn't familiar to me, so I can't tell.) How about comparing C-h v features before and after visiting that file. You can require those features in your init file (many would just be dependencies of others, but require won't re-load things which are already loaded, so it's safe).
|
|
Jun 29, 2021 at 13:37 | comment | added | Snelephant | @phils Same behavior if emacslient -c is invoked first without visiting files. After invoking, visiting the first file takes 8 seconds and subsequent invocations of the identical file with different name takes less than one second. | |
Jun 29, 2021 at 13:27 | comment | added | phils | Please test per my first comment, without visiting files. | |
Jun 29, 2021 at 13:25 | history | edited | Snelephant | CC BY-SA 4.0 |
added 215 characters in body
|
Jun 29, 2021 at 13:22 | comment | added | Snelephant | @phils I performed the same test using the identical org file renamed to .txt. The load times are faster, but there remains the same differential. The first invocation of emacsclient takes about four times as long to load as subsequent invocations of the same file (with only the file name change.) The overall slowness may be related to the fact this is a virtual machine (Windows Subsystem for Linux.) | |
Jun 29, 2021 at 13:15 | comment | added | Snelephant |
@phils org packages are successfully loaded by the daemon: Loading package org... Configuring package org... Configuring package org...done Loading package org...done (1.840s) , so I don't think this is the cause of the differential delay observed between opening these identical files in arbitrary order using emacsclient. Though it could be some other package or process that is not being loaded by the daemon and is deferred to the first but not subsequent invocations of emacsclient.
|
|
Jun 29, 2021 at 13:03 | comment | added | phils | I've converted this to an answer, as I think it's very likely to be correct. | |
Jun 29, 2021 at 13:01 | answer | added | phils | timeline score: 3 | |
Jun 29, 2021 at 12:02 | comment | added | phils |
Re-reading, you're saying this is for org files, and org-mode is a huge set of libraries for which loading takes a noticeable amount of time even on my fast machine, so I suspect the situation is exactly as I've suggested above. Simply (require 'org) in your init file if you want to automatically load it when Emacs starts.
|
|
Jun 29, 2021 at 11:59 | comment | added | phils |
A related test: emacs --daemon "filename1" followed by emacsclient -c "filename2"
|
|
Jun 29, 2021 at 11:55 | comment | added | phils |
Those times seem very slow regardless of any actual issues; however... you're complicating things by visiting a file with your first client. Are the timings different if you repeatedly use emacsclient -c rather than emacsclient -c "filename" ? If the slowness is not "the first time I start a client" but rather "the first time I visit a file of a given type" then it will just be the time taken to load whichever libraries are relevant to that type of file. (Are "filename1" and "filename2" the same type of file?)
|
|
Jun 29, 2021 at 11:44 | history | edited | Snelephant | CC BY-SA 4.0 |
added 193 characters in body
|
Jun 29, 2021 at 11:31 | history | asked | Snelephant | CC BY-SA 4.0 |