Make Emacs Faster

Make Emacs Faster
Share on:

Emacs is probably my favourite “text editor” to use on Linux, as it is so extensible. However, the one thing that puts many people off using it (ignoring its complexity), is the fact that it is only single threaded, and can at times feel a little sluggish when compared to other editors like Vim.

With Emacs 28.1, along with the libgccjit (Just-In-Time Compilation with GCC) library, we now have the ability to translate Emacs Lisp into machine code on demand - which will speed things up. With this, you may notice a drastic speed increase during your day to day use of Emacs.

📝 For this guide I’m using an Arch-based Linux distribution called EndeavourOS, and the DOOM Emacs config.

Uninstall Emacs

If you’ve already installed an older version of Emacs with your package manager - uninstall it:

yay -R emacs

Download Emacs 28.1

First we need to download the source code for the latest version of Emacs:



Then we need to unpack it:

tar -xf emacs-28.1.tar.xz

Let’s navigate into the Emacs source folder:

cd emacs-28.1/

Install libgccjit

Now let’s install the required JIT compilation with GCC backend library:

yay -S libgccjit


We can now build Emacs:

./configure --with-native-compilation

Now, we can make:

make -j$(nproc)

And lastly, install it for use:

sudo make install

# where is it?
whereis emacs
# > emacs: /usr/local/bin/emacs /usr/local/lib/emacs /usr/share/emacs

# check version
emacs --version
# > emacsclient 28.1

Emacs Client

I like to run the emacsclient rather than just launching Emacs the normal way you’d load other apps via a menu or launcher. By doing this we can launch into it faster, as the emacsclient runs in the background and will spawn windows almost instantly when called this way.

In your application startup add this:

emacs --daemon &

If you use a window manager, you will want to add this command to your autorun script, like I do, as shown here using awesomeWM.

In your hotkeys you can add a command to launch Emacs in client mode. This is how I do it using sxhkd:

# ~/config/sxhkd/sxhkdrc

# Emacs
super + alt + m
    emacsclient -c -a emacs

Set Emacs As Default Editor

You can make Emacs your default text editor by setting up a few variables which your system will use when you log in. To do this, edit your .profile file in your $HOME and add the following:

# ~/.profile
export EDITOR="emacsclient -c -a emacs"
export CODEEDITOR="emacsclient -c -a emacs"
export VISUAL="emacsclient -c -a emacs"