jmhimara · 2022-03-16 05:51
So I am running emacs on my work mac and my personal mac computer. Both run the same version (28.0.50) and same personal config. On my personal mac, it takes about 5-7 seconds to start up (which seems a bit long, but tolerable). On my work mac, on the other hand, startup is about 90s. This wasn't always the case. It initially ran the same on both computers, but one day it suddenly slowed down. I don't remember if I did anything to break it, but the config file is the same on both.
I ran the `esup` profiler and it tells that the total user startup time is 0.123 sec, which is obviously not true (or the the slowdown is not due to the config file).
Any idea on what might be going on or how to accurately profile the startup process?
EDIT: I seem to have [solved the problem](https://www.reddit.com/r/emacs/comments/tfalfg/emacs_starts_up_slow_on_one_mac_but_fast_on_the/i0wvbe9/). Not sure how or why, but at least it starts up reasonably fast now.
konrad1977 · 2022-03-16 06:27
If you run Emacs -Q are they equally slow/fast then? Do you have anything in your config that would run on one machine and not the other? Like x86/arm64 specific functions? If you open Message Buffer do they contain the same messages?
jmhimara · 2022-03-16 06:55
`emacs -Q` starts up immediately. There's nothing architecture specific in the configs -- both are intel-based macs. Similarly, both message buffers display the same thing (basically a list of packages being loaded).
However this time I noticed that while it starts, the message displayed the longest (in the little buffer at the bottom, not sure what it's called) is `Loaded /PATH/TO/CONFIG/config.el`. That part in the Message Buffer :
Loading /PATH/TO/CONFIG/config.el (source)...done
Loaded /PATH/TO/CONFIG/config.el <---- THIS LINE HANGS
Loading /PATH/TO/CONFIG/recentf...done
Cleaning up the recentf list...done (0 removed)
Every line before or after seems to go by rapidly -- although the message seems to suggest that it's already loaded, so not sure.
7890yuiop · 2022-03-16 07:40
Recursively bisect your config to isolate which part causes the slow-down.
Maybe temporarily rename your recentf file on the slow system to see whether it was just having a hard time loading *that* (perhaps some tramp-related timeout is happening).
jmhimara · 2022-03-16 18:01
I've commented the entire config and it's still slow. Could it be something in my init.el file?
Also changing recentf didn't do anything.
EDIT: OK, it seemed to be my init.el file. Opam (the Ocaml package manager) had added something in that file. Once I deleted it, the problem went away.
crawsphi · 2022-03-16 18:11
Does your work install one of those obnoxious "endpoint security" programs on its machines? Those are common causes of slowdowns for programmers.
jmhimara · 2022-03-16 18:19
It does, but that wasn't the issue. I figured out what the issue was.
https://www.reddit.com/r/emacs/comments/tfalfg/emacs_starts_up_slow_on_one_mac_but_fast_on_the/i0wvbe9/
7890yuiop · 2022-03-16 21:45
You can't think about "your config" without including your init file -- that is numero uno!
jmhimara · 2022-03-16 21:51
True, but the init file is so minimal that I didn't think anything there was the issue. Plus, the same exact line is also present in the "fast" computer. For some reason it's causing a problem in one machine, but not the other. Oh well....
jxfreeman · 2022-03-17 01:01
Are you running the emacs —daemon?
jmhimara · 2022-03-17 01:06
no.
jxfreeman · 2022-03-17 01:30
Using the daemon in conjunction with the emacsclient will greatly improve the apparent stat-up speed.