reddit / emacs

Is it worth using doom emacs with native compilation?

ScottAstatine · 2022-03-16 08:53
I know this might be stupid probably is but, installing doom for the first time with [this](https://github.com/scott-astatine/doom-config) config takes a lot of time on my Laptop with 4GB ram and dual-core CPU to natively compile over 2000 files. My question is this just because of my laptop config or is emacsgcc compile real slow? ^(By the way, I'm a noob with emacs so please be polite.) And could mention some pros and cons of emacsgcc!
r0flcopt3r · 2022-03-16 09:44
No doubt compiling using a dual core is going to be slow. It feels like it takes forever with my M1... Your computer will benefit a lot from using native compilation, especially given how slow it is. Pro: everything is faster. Emacs feels a lot snappier. Con: compilation times suck
cathedral_mistreat · 2022-03-16 09:47
Even on a beefy machine compilation takes quite some time. There's some discussion on it here: https://github.com/hlissner/doom-emacs/issues/6137 Regular gccemacs can compile ahead of time, as done here, or in the background as you're using emacs. I don't know how to tell doom to do it in the background. The pro is that natively-compiled functions run a bit faster, leading to emacs feeling a bit snappier. If I had a 4 gb dual core machine, I'd either start the installation before I go to bed or take a break, or just stick to emacs 27 until these things have been figured out - emacs 28 is not the stable version after all.
7890yuiop · 2022-03-16 09:47
If you rebuild Emacs regularly, or if you update packages regularly, then be prepared for native-compilation to be an extremely frequent thing. All you can really do is try it and see. Some people find it's worthwhile, others find it isn't, but we can't predict that for you.
7890yuiop · 2022-03-16 09:49
> natively compile over 2000 files You have over 2000 `.el` files in your config?!?
thiscarhasfourtires · 2022-03-16 10:25
I think they're counting all files and packages from Doom.
naokotani · 2022-03-16 10:50
Might benefit from making their own config.
eli-zaretskii · 2022-03-16 13:13
Why are you compiling all of your Lisp files ahead of time? That is not how native compilation is supposed to be used. You are supposed to let Emacs compile each file in the background if and when it is loaded. This way, you don't need to wait for the compilation, and also, you never compile files you don't use.
adamnew123456 · 2022-03-16 16:30
Probably not something OP enabled explicitly, it's the default behavior of Doom when your build of Emacs supports native-comp. As to why they did it this way: ? I guess they were byte-compiling the world before native-comp was a thing and added native-comp into that framework.
eli-zaretskii · 2022-03-16 16:55
> I guess they were byte-compiling the world before native-comp was a thing and added native-comp into that framework. IMNSHO, that's a mistake: native-compilation is not the same as byte compilation, precisely because it is much slower.
reddit_clone · 2022-03-16 16:56
Actually mine does as well. Anytime I do a 'doom install' ('doom upgrade' doesn't work sometimes, ending up in errors. So I always do fresh 'doom install') it native compiles 2000+ files and takes 20+ minutes in my late model Intel Mac with 32 GB memory. I would be interested to know to set up on-demand, lazy compilation.
eli-zaretskii · 2022-03-16 17:02
I don't really know how Doom changed the default (because the default *is* to compile only when a Lisp package is loaded and there's no `.eln` file for it). My guess would be that they changed the value of `native-comp-always-compile` to be non-nil? If so, just reset it to nil, and make sure `native-comp-async-jobs-number` is zero, which will cause Emacs toi compile using half of the available CPU execution units. If this doesn't help, I guess you will need to ask the Doom maintainers how they set this up.
eli-zaretskii · 2022-03-16 17:02
> because it is much slower And also because it must be compiled on the end-user's machine (or on some very similar system).
thiscarhasfourtires · 2022-03-16 21:20
Everyone says that. I respectfully disagree.
naokotani · 2022-03-16 21:57
I prefer making my own config, but I've used doom and it's very well done. I just thought that a more minimalistic approach could be at least worth considering for this particular case.
7890yuiop · 2022-03-16 23:57
> or just stick to emacs 27 until these things have been figured out - emacs 28 is not the stable version after all. True, but I don't think anyone is anticipating significant changes to native compilation in 28.1 compared to how it's working right now (given we're currently in the pretest stages for that release).
panickbr · 2022-03-17 02:44
https://www.reddit.com/r/emacs/comments/p82jw2/comment/h9nh0bc/ got curious aswell and just found this comment by /u/takutekato > In your $DOOMDIR/init.el: > > (setq native-comp-deferred-compilation t) > > In your $DOOMDIR/cli.el (create it if it doesn't exist): > > (advice-add #'native-compile-async :override #'ignore) > > This will completely disable AOT native compilation when we are using Doom's CLI, but leave deferred native compilation intact just like Emacs's default.
thiscarhasfourtires · 2022-03-17 05:44
Yes. You can, of course, simply remove any module. You can also install Doom Emacs without any package whatsoever, with the command `doom install --no-install`.
eli-zaretskii · 2022-03-17 07:02
Emacs 28.1 will be released very soon (I hope), as it is quite stable. No changes in how native-compilation works in Emacs 28 are expected before the release. "It works for me" in production for many moons now.
cathedral_mistreat · 2022-03-17 07:44
Agreed, I was more thinking about the doom emacs side of things. It's understandable if they haven't configured their system properly for emacs 28 yet.