unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Compilation speed
Date: Thu, 06 Aug 2020 17:20:13 +0200	[thread overview]
Message-ID: <87bljnby36.fsf@gnus.org> (raw)

A nice thing about new, shiny machines with a bunch of cores is that it
makes saying "make bootstrap" faster when I want to check stuff.

However, there's a couple of sections that are single-threaded, which
makes the machine mostly idle while building, and I wondered whether
anybody has looked into these things...

I did a bootstrap (with make -j8) and timestamped the lines to see
whether anything in particular stands out.

[larsi@stories ~/src/emacs/trunk]$ emake bootstrap 2>&1 | ts -s
00:00:00 rm -f libXMenu11.a ./*.o deps/*
...

First deleting a lot of stuff...  that's fine...

00:00:03 running CONFIG_SHELL=/bin/bash /bin/bash ./configure --no-create --no-recursion
00:00:03 checking for xcrun... no
00:00:03 checking for GNU Make... make

[...]

00:00:22 config.status: executing etc-refcards-emacsver.tex commands

And then ./configure takes 19 seconds, and that's fully single-threaded,
I believe?  And...  I'm guessing there's no way to get that to be
multi-threaded?

But I've also long wondered whether anybody has actually pruned the
tests lately?  Are all those tests (for things that seem really trivial,
mostly) really necessary these days?

And then compilation of Emacs and the manual starts, and that bit uses
all eight cored:

00:00:22   GEN      alloca.h
[...]
00:00:22   GEN      ../../info/eintr.info
00:00:22   GEN      sys/random.h
00:00:22   GEN      sys/select.h
00:00:22   GEN      ../../info/elisp.info
00:00:38   GEN      sys/stat.h
00:00:38   GEN      sys/time.h
00:00:38   GEN      sys/types.h
[...]
00:00:50   CC       minibuLoading loadup.el (source)...
00:00:50 dump mode: pbootstrap

So the build of the temacs binary just takes 28 seconds.

00:00:50 Loading emacs-lisp/byte-run (source)...
00:00:50 Loading emacs-lisp/backquote (source)...
[...]
00:01:02 Dump complete

And dumping takes 12 seconds.  Then some other bits are compiled and
then we start the pbootstrap:

00:01:07 ./temacs --batch  -l loadup --temacs=pbootstrap

This seems to proceed in parallell until we reach:

00:01:17   INFO     Scraping files for loaddefs.el... 
[...]
00:01:54   INFO     Scraping files for loaddefs.el...done

Which is single-threaded and takes a whopping 37 seconds!  Could that
possibly be parallelised in some way?  Probably be tricky...

00:01:54 Loading loadup.el (source)...
[...]
00:01:58 Dump complete

Another dump; takes just four seconds.

00:02:00   ELC      ../lisp/language/khmer.elc
00:02:00   ELC      ../lisp/language/korean.elc
[...]
00:02:46   ELC      progmodes/cc-styles.elc
00:02:46   ELC      progmodes/cc-mode.elc

And finally, all the remaining (undumped) .el files are compiled, and
this uses all the cores, so it takes just 46 seconds.

Hm...  well, I guess if somebody wanted to speed up compilation, then
the loaddefs scraping is the biggest single item here to look at.

But to sum up, (+ 22 12 37 4) => 75 seconds of the Emacs compilation is
single-threaded, while 90 seconds are multi-threaded (and as machines
get more and more cores, we'll probably see the single-threaded parts
take more than 50% of the time spent).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




             reply	other threads:[~2020-08-06 15:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 15:20 Lars Ingebrigtsen [this message]
2020-08-06 19:07 ` Compilation speed Paul Eggert
2020-08-19  9:25   ` Mario Lang
2020-08-19  9:43     ` tomas
2020-08-19 12:37       ` Ergus
2020-08-06 22:14 ` Stefan Monnier
2020-08-07  6:55   ` Lars Ingebrigtsen
2020-08-07 16:26   ` Andrea Corallo via Emacs development discussions.
2020-08-10 14:33 ` Arthur Miller
2020-08-12  2:11   ` Paul Eggert
2020-08-12 12:53     ` Arthur Miller
2020-08-12 16:08       ` Stefan Monnier
2020-08-12 16:59       ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bljnby36.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).