Skip to content

Speedier Emacs Startup with Custom Configuration

GUI elements in my Emacs are a scarce resource. The only one I display is modeline. I am always looking for screen space, especially vertical since the shift to flat screens and new “wide” formats. Turning off menus, toolbas and similar stuff gives me more space. I prefer to have bigger fonts since I am almost blind as bat, rather then spending that space on few buttons I never use anyway. Since I don’t use much of it the gui, I configure my Emacs to not compile it in either most notably Gtk.

What I didn’t realized is that Emacs will also start faster with slightly less features compiled in. Should be self-evident actually, but I never thought about it. I realized when I was playing with a new setup in order to make my Emacs start faster, and come down to ~0.1 sec for daemon mode. (A standalone process starts in about 0.33 secs on my computer).

As I remember, the stock version of Emacs used to start ~0.5 secs, but it was really long time ago I used pre-compiled Emacs from official distribution. I thought they have done something significant in latest release, since I don’t think I can configure Emacs to run faster then what we get when we run emacs with -Q option.

So I tested: stock Emacs of stable version starts in about ~0.45 sec on my computer. Latest version is 27.1-3 as in official Arch repo.

After compiling my own “stock” version from latest master, I get approximately same startup time ~0.4 secs.

However, when I run my personal configured Emacs with -Q option I get it down to ~0.22 secs. That is almost halv the time without me doing literally anything with the setup!

This is what I have used to configure it

./configure –without-makeinfo –with-cairo –without-modules
–without-compress-install –with-x-toolkit=no
–with-gnutls –without-gconf –without-xwidgets
–without-toolkit-scroll-bars –without-xaw3d
–without-gsettings –with-mailutils –with-nativecomp
CFLAGS=”-O3 -mtune=native -march=native -fomit-frame-pointer”

I am not an expert in configuring Emacs; I have just tried to get rid of as much as possible of what I don’t use. I normally don’t have any other gui elements in Emacs but modeline, nor do I use menus, context-menus and similar, so I can leave those out. I don’t recommend this as a general thing one will do, since seriously half of 0.5 sec is well not so much to hurray for;
we humans don’t notice difference between 0.2 or 0.4 sec setup anyway. But it was cool curiosa, and I felt to write something today :-).

Post a Comment

Your email is never published nor shared. Required fields are marked *