Ninja benchmark with 1k, 10k and 100k source files

471 views
Skip to first unread message

David Rothlisberger

unread,
Nov 4, 2016, 12:11:07 PM11/4/16
to ninja...@googlegroups.com
Hi, long-time Ninja fan here.

I used a script in Tup's test suite to generate some projects with 1k,
10k and 100k C files to test the performance of Ninja vs. GNU Make
(on Linux).

There isn't much difference in full builds from a clean checkout. For
no-op builds, Make still takes <1s with 10k source files (Ninja takes
0.13s). At 100k source files Make's performance explodes a bit, to 73s
vs. Ninja's 1.5s -- pretty much all of Make's time goes into processing
the 100k ".d" dependency files corresponding to the 100k source files.

More details here: http://david.rothlis.net/ninja-benchmark/

Cheers,
Dave.

Nico Weber

unread,
Nov 4, 2016, 12:20:34 PM11/4/16
to David Rothlisberger, ninja-build
Cool, thanks for sharing!

In response to the number of source files: I don't have sloccount on my machine, but I know that building clang runs ~2500 build steps (most of them compilations), see e.g. http://lab.llvm.org:8011/console -> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 -> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/274/steps/build%20stage%202/logs/stdio (that's stage2 of a bootstrap build of the compiler, so that stage always builds all files).  Chromium runs ~50000 build steps, also mostly compilations, so that's roughly 20x the size of clang (build.chromium.org -> https://build.chromium.org/p/chromium/builders/Linux%20x64 -> https://build.chromium.org/p/chromium/builders/Linux%20x64/builds/28095/steps/compile/logs/stdio). In 64-bit chrome/android builds, we build over 70000 build edges, since we build everything for both 32-bit and 64-bit (so the number of inputs is the same, but the number of outputs doubles -- https://bugs.chromium.org/p/chromium/issues/detail?id=661865). Android might be even larger, but I haven't tried that myself.

In response to "Ninja seems to build leaf nodes in the build graph as soon as possible": Ninja builds nodes in the order they're listed on in the build manifest (where permitted by dependencies).

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Rothlisberger

unread,
Nov 7, 2016, 5:30:35 AM11/7/16
to Nico Weber, ninja-build
Thanks Nico! I've updated my article.

Cheers,
Dave.
Reply all
Reply to author
Forward
0 new messages