Emacs Byte-Compiling

I recently became annoyed at how long my emacs took to start up, so I investigated ways to speed up the start time. The first thing I came across is huge: byte-compile all your elisp files.

Most major packages come with a makefile that will compile their .el files into .elc, but if not the following elisp function will compile all the .el files in a directory:

(byte-recompile-directory "~/emacs" 0)

However, I’ve found that doing this can mess up the current emacs session, so you may wish to use emacs from the command line to byte-compile files, as follows:

emacs -batch -f batch-byte-compile *.el

Compiling my elisp led to a speedup of roughly 5x when starting emacs, so I definitely suggest you compile your elisp files.

Tags:

Leave a Reply