Here are various suggestions.
- No elc files.
As stated below, compiling all of the lisp files accounts for at least 10% of the time. One way to disable that is to edit the loaddefs target in file lisp/Makefile
and change that to:
$(lisp)/loaddefs.el: $(LOADDEFS)
true
- No compiler optimization or debugger symbol tables
Currently, I'm passing --with-x-toolkit=no --without-x --without-all to ./configure.
I was able to reduce C compilation time to 1/4 the time (from a little less than minute to 16 seconds) in the src just changing the default compile flags. The default CFLAGS I got had been: -g -O3
.
So use instead CFLAGS=''
.
- Don't run
make install
, but just run the built emacs from inside the src directory.
As stated below another 10% of the time is in building docs. Although I didn't time it, there is no doubt a lot of time copying files and compressing elisp files in make install
. So don't. If you want to redo the timing charts, run remake --profile
.
The above observations are based on below....
First step is to understand where the time is spent to figure out how to reduce it. Fortunately for something like Emacs, I recently wrote (or rather extended) a tool to help you find out. I added a --profile
option to remake (a fork of GNU make) which will tell you how much time is spent in specific targets.
I tried that building a recent snapshot and yes it takes about 10 minutes. If you don't have remake installed, I have a gist of the profiling information you can use of my run. I use kcachegrind to display the information but there may be other tools out there for visualization tools. There is a png in the gist which is a screenshot of the run.
Now to the details...
In my run, about 20% of the time is spent in building lisp and info files which you don't really need to do. Actually a little more is spent in the lisp files than in the info files. You could probably change the Makefile to skip that.
It might be interesting to compare with emacs 24. My guess is that the sizes of both of these has grown proportionally.
If there is interest (which you can show by upvotes), I'll suggest specific hacks to the Makefile. However this by itself should be enough for someone motivated to work from.
./configure --with... && make -j (number of cores * 1.5)
finishes in 30 seconds. If you are running on a local machine, make sure to use the -j argument to make. Is there a good reason for you to domake install
? This will add a little bit of time you could avoid if you just run emacs from the src directory../autogen.sh
to generateconfigure
, but that's a matter of seconds, not minutes.make install
run silently. So please split these into 3 questions so they can be tracked separately and edit this accordingly to stick with one question.