reddit / emacs
What is expected Doom performance on macOS?
bambataa199 · 2022-02-28 22:20
I am experimenting with Doom Emacs but it feel like performance is at least as bad as it was with my hand-rolled config. I am running 28.0.91 with native comp on Mojave.
The stated startup time on the splash screen is normally 2-3 seconds: "Doom loaded 208 packages across 34 modules in 2.06 seconds". Restoring my previous workspace with 20-30 buffers takes 7-8 seconds. Opening a file in a project takes 1-2 seconds. At first I thought it was due to LSP mode, but it's still slow even with it disabled.
I have followed some of the recommendations in Doom's README "why is Doom slow?", but my situation seems a bit more pathological than what those try to address.
I tried profiling opening a single line file (took a second or two) and the CPU profile says that it spent 28% of its time in automatic GC and 51% of its time in `vertico--advice`. I'm assuming that was the file selection popup, so it appears that Emacs is really just spending all its time waiting for something. I'd be grateful for advice how to debug further.
gdanov · 2022-02-28 22:44
Mojave? What model Mac is that?
If both vanilla and doom emacs are "bad" either you are repeating a mistake or the problem is outside of emacs.
My emacs has sped up significantntly with native compilation. Have you checked and made sure it really works? I did not get it right the first time on my older OS.
7890yuiop · 2022-02-28 23:51
> I am experimenting with Doom Emacs but it feel like performance is at least as bad as it was with my hand-rolled config
`emacs -Q` is the baseline you should be comparing against.
LemonBreezes · 2022-03-01 02:01
You can disable all the modules by not having an `init.el` file in `.doom.d`. Then you can try out modules little by little.
Even Doom Emacs without modules is useful because it does a lot of optimization tricks and "common sense" things that will save you time compared to rolling your own config from scratch.
__nautilus__ · 2022-03-01 02:03
It doesn't fix your startup time problem, but generally I'll start a single instance of emacs (actually as a systemd service in daemon mode on linux), and then use `emacsclient` to open emacs quickly from there on, so personally I don't worry too much about it.
Taking that long to open a file isn't something I've seen. Does it take that long to display the file once you've selected it, or does it take that long to become interactive once the file is displayed?
Something to try with doom in particular is their sandbox mode, which lets you run emacs with doom modules but without your private config, with just doom core, and vanilla emacs (no doom). You can get a little buffer prompting for which you want if you run M-x `doom-sandbox`. This should help you narrow down and figure out whether it's something about your private config, something about a doom module, or something about doom itself.
mclearc · 2022-03-01 03:47
I don’t use doom. But I’m on Mac OS 12 and emacs 29 and my startup time is between .35 and .5 seconds with over 150 packages. So it sounds like something with your config.
otavioschwanck · 2022-03-01 06:27
Same here with M1 mac
bambataa199 · 2022-03-01 09:01
Brain fade! It's a 2017 i5 running Big Sur. Don't know why I said Mojave. So it's a bit old, but should be able to handle Emacs.
I found my handrolled config was more performant. Re native comp, I can see that it's enabled in Emacs. What more should I do to check that it's really working?
gdanov · 2022-03-01 09:45
Can't figure out the proper search phrase, but please carefully check your emacs logs and make sure it's really compiling. Mine didn't bring any errors, but was failing to compile.
Also, make sure you are installing it with the proper flags, if using brew.
2017 i5, 8+ram and ssd should be able to perform very well
bambataa199 · 2022-03-01 10:42
So I haven't gone through every module in init.el, but I've got to a usable state with LSP etc and performance is decent. Here's what I found:
Basic Doom loaded in about 1 sec.
Adding Evil brought it to around 1.5-1.8s, which I think is reasonable considering what Evil does. Some combination of Dired and Magit made the file finder lag a little on first opening, but only on opening.
Modeline, even the lightweight version, and `:checkers syntax` seem to have been my two performance killers. Presumably I can disable syntax checking and `:tools lookup` if I am using LSP?
guitmz · 2022-03-03 23:57
I don’t have nearly around 150 packages and I’m already at 1.2s. How do you keep it so low? I think I’m doing something wrong (still learning this).
Startup benchmark says evil is taking around 250ms, org is around 200ms and eglot around 100ms. Everything else seems low enough.
Funny thing is that those 3 packages above don’t have many customised options on my side so maybe there’s a way I can speed them up or delay them. I’m not using use-package at this time just after-init hooks (based on Spartan-eMacs)
eMacs 28 on MacM1 btw
mclearc · 2022-03-04 01:03
You’re welcome to take a look at my config to see if there’s anything I’m doing that you’re not. I try and configure and defer as much as I can as possible. I’ve taken a bunch of ideas from doom. And I also do a lot of configuration of “built in” packages. There’s some garbage collection voodoo and frame settings in the early init that make a real difference. One nice thing about use-package is that it tracks your load time for each package you use with it so long as you set ‘use-package-minimum-reported-time 0’.
Here’s the link: https://github.com/mclear-tools/dotemacs
guitmz · 2022-03-04 08:02
Thanks a lot! I’ll take a look. This use-package feature is neat, I was not aware