frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Faster Than Ninja

https://build2.org/blog/faster-than-ninja.xhtml
46•elasticdog•3h ago

Comments

ladams•1h ago
> And now we are 2.2% faster than Ninja!

This claim isn't supported by the author's measurements?

karen_arutyunov•1h ago
1 - 3.355/3.429 = 0.021581 = 2,2%

no?

boris•1h ago
At least you know it was written by a fallible human. But if you point out my mistake, I will be happy to fix it.
evmar•1h ago
[Ninja author here] Nice post, cool to see the deep dive! I also appreciate the details on how they produced their numbers.

As they observe, Ninja gets to be fast mostly by cheating: it avoids a lot of work by saying many things are just out of scope for Ninja to do, and that means it is a useful a target to race against. (Funny thing: when I wrote Ninja I was misremembering how fast an earlier build system was so I kept trying to make it faster. So don't treat it as a lower bound, I just made it up!)

I comment here to say I find the explanation for 'why' in this post unsatisfying. They mention three design decisions.

The first one is a criticism of CMake, not Ninja (?), so I don't think it can be why. I might have misunderstood?

The second reason given is doing some work like header dependencies in multiple threads. This is the most plausible reason to me but it still feels unlikely. It's a very small amount of work: the post mentions 300 compiles, so maybe parsing 300 small text files?

The third is that they run the compiler up front an additional time to gather headers, which is strictly more work than Ninja. There is some hand waving about file access patterns but I am skeptical; if the end-to-end build time is 3 seconds then the project is small enough to all fit in kernel caches. They also mention doing other things like invoking the compiler to get version information. This seems like it would dwarf any performance gain from number 2.

Maybe it's just my own curiosity, I think this post would be better if it had a better explanation for the reason. I'm not disputing the result, I just think the result should make you suspicious that something else is going on, and you might learn something from that! You could for example explore whether it's the header dependency thing by profiling the Ninja invocation and seeing if it's waiting for CPU or waiting for tasks to execute.

(If I had to guess without looking at any of the involved code, I would predict it's something about how CMake generates the build, like it introduces serialization in a place where build2 is parallel, or it adds some extra build steps like gathering the current git hash into a header file or something.)

eska•1h ago
Always glad to see authors on here. Thanks for your insight!

Since they had to rewrite the build file for their program I also assume that something is missing. Didn’t see any mention of verifying that.

I also really didn’t like their denigrating tone. It totally turns me off trying build2, because it seems they don’t understand the point of separating build stages like environment setup (getting dependencies), configure, native build, cross build, packaging. I am a very happy ninja user instead of a batteries-included solution because it does its one job well and can be used very flexibly. I personally detest cmake, so I use nix + own configure script + ninja.

The blog is also wrong about ninja being unable to call configure, but I intentionally don’t want that (I want the build stages to communicate in one direction for sanity).

Orphis•59m ago
> I want the build stages to communicate in one direction for sanity

That's easy to do if you control the whole pipeline and can integrate all the features together, not so much with the CMake model unfortunately. I think it would be nice if CMake had Ninja integrated as a library, it could lead to some nice optimizations later.

Orphis•1h ago
Simple CMake projects using the Ninja generator are very efficient, unless you create generated files.

And if they are in their own targets, they are not really an issue (they would serialize everything that depends on them as you'd expect), but if you have them in a library grouped with other files to compile, then the whole library compilation is serialized.

And obviously worse if you also have to build the generator for the generated files, but that's not a big surprise, you can observe that in full builds of Chromium or its libraries too waiting for protoc if you crank the parallelization a lot.

evmar•51m ago
shevy-java•55m ago
Great that there are performance benefits, but one thing that I think both meson/ninja and cmake (or cmake/ninja) got wrong, and GNU configure got right is "./configure --help". Why do neither of these tools simply add --help here? Yes, their syntax is different, but the issue is not only about --help. Often I could disable documentation or man page via --disable-man or --disable-doc or something like that. I recently had a discussion with a guy who transitioned into ninja, and I reasoned that there should be an option to skip installing man-pages. He thinks everyone needs manpages. I told him I never look at any local man page ever; I only look online for help. And have been doing so for almost 30 years. I understand the 1970s era of man-pages, but I have no use for them (I do gather local documentation, just not via manpages). He did not want to add a way to install his software without having available xmlto, docbook variants (which are a pain to install, just look at the LFS/BLFS instructions and even then they do not work cleanly). Meson and cmake are better than the GNU autotools, but the few things GNU autotools got right, were lost in both meson and cmake, which is interesting. It seems we can only select between different trade-offs here. New is not automatically better. And being 5% faster really is pointless if functionality is removed or not available anymore.
quotemstr•44m ago
I wish that when people posted a performance win, they would include a theory explaining it. Unexpected speedups are usually noise, bugs, or harness issues. No program is faster due to the superior manly virtue of its programmer. Every effect has a cause.

When, from first principles, something shouldn't be faster, yet it is, you dig and dig until you understand. You don't just say your shit rules and the other thing sux0rz. If you do, you'll regret it: if you don't understand how you got a win, you don't understand how to keep it.

zamalek•52m ago
> Let's see if we can go even faster. Next, we disable compression in the file cache. We will discuss the file cache in more detail a bit later but for now let's just say that by disabling compression we trade temporary disk space usage for speed:

Something is wrong here. Which compression algorithm is being used here and how much has it been tuned? A core hypothesis of the likes of zram is that disk access is so slow (even NVME), that you can often beat it with the bit-rate of decompression.

1. Is something slow like gzip being used?

2. Is the compression effort over-tuned for size? Do some space benchmarks and make sure that you aren't saving a few dozen MB on GBs of data.

zstd, with 1-3 effort (you may even find negative is a overall win), and a trained dictionary (your data does all look identical) is probably a good start.

bluGill•21m ago
Cmake spend 15 seconds to generate this project? I find it unlikely build2 is doing the same work as cmake is. Now I will grant cmake is single threaded and slow, so there is a lot of room to do the things it does better (the language sucks, and is part of what forces single threaded). It also wouldn't surprise me if cmake is doing things that are not really needed (odds are the default compiler works - most of the time it isn't valuable to check the version)
Meneth•21m ago
I wonder how it compares to Tup ( https://gittup.org/tup/ ).
Yes, I don’t remember the details but vaguely remember that CMake tends to group things together that could in principle be made more parallel, as you mention with generates files in a library. On the other hand if build2 makes it easier for authors to express these kinds of patterns without the serialization then I count that as a win for build2!
boris•8m ago
[build2 author here] Thanks for the feedback! Some additional details:

> The first one is a criticism of CMake, not Ninja (?), so I don't think it can be why.

Fair enough. The point I was making is that if you want to compete with Ninja, you cannot leave any potential performance gains on the table.

> The second reason given is doing some work like header dependencies in multiple threads. This is the most plausible reason to me but it still feels unlikely.

We are talking about ~2% performance difference here. Parallelizing even a small amount of work across 24 threads rather that doing it serially saving a percent or two feels plausible to me.

> There is some hand waving about file access patterns but I am skeptical; if the end-to-end build time is 3 seconds then the project is small enough to all fit in kernel caches.

It fits into the system's file cache unless there is memory pressure, like one would expect from having 24 C++ compiler jobs running in parallel. We actually measured this in isolation (with more detailed results in the linked article) and it has a noticeable effect.

> They also mention doing other things like invoking the compiler to get version information. This seems like it would dwarf any performance gain from number 2.

I measured this, it costs 70ms or ~2% of the overall time.

Qwen 3.0 Image Pro

https://www.qwencloud.com/models/qwen-image-3.0-pro
79•theanonymousone•1h ago•26 comments

Cloudflare OS: an open platform for agents, apps, and work

https://blog.cloudflare.com/cloudflare-os/
268•speckx•2h ago•149 comments

Google DeepMind CEO Demis Hassabis is stepping down

https://www.axios.com/2026/08/05/google-deepmind-demis-hassabis-ai
142•ot•38m ago•69 comments

Aristotle quotes on virtue, knowledge, and happiness

https://www.campion.edu.au/blog/top-25-aristotle-quotes-on-virtue-knowledge-and-happiness/
81•teleforce•2h ago•25 comments

Cops Used Flock to Track a Man Across State Lines for a Pretextual Weed Search

https://www.404media.co/cops-used-flock-to-track-a-man-across-state-lines-to-create-pretext-to-se...
158•cdrnsf•1h ago•53 comments

Oracle Just Halved Its Always Free ARM Limits

https://www.cnelecar.com/blog/oracle-always-free-arm-limits-cut-2026/
42•iplaypc•1h ago•35 comments

Discovery Loop

https://www.discoveryloop.com/
15•xtreak29•24m ago•1 comments

Jeff Dean leaving Alphabet

https://www.nytimes.com/2026/08/05/technology/google-researchers-ai-startup.html
87•louiereederson•39m ago•14 comments

The Entropy of a Markov Chain

https://chillphysicsenjoyer.substack.com/p/the-entropy-of-a-markov-chain
45•surprisetalk•2h ago•2 comments

Western Sahara

https://en.wikipedia.org/wiki/Western_Sahara
19•brudgers•18h ago•5 comments

Painting with Gaussians

https://yogthos.net/posts/2026-08-03-splat-painter.html
40•yogthos•3h ago•2 comments

Discovery of a multicomponent alloy forged by the Hiroshima atomic blast

https://www.science.org/doi/10.1126/sciadv.aeg8299
33•_____k•5d ago•9 comments

Building an Advanced Agentic Harness

https://data4sci.com/blog/building-an-advanced-agentic-harness
50•Anon84•2h ago•24 comments

Rubin Observatory's first LSST Camera release: 500k galaxies in the COSMOS field

https://rubinobservatory.org/news/rubin-new-window-cosmos-field
32•MarcoDewey•2h ago•1 comments

The Valley of Webhooks

https://weli.dev/blog/the-valley-of-webhooks/
12•weli•1h ago•6 comments

The "Disability Dongle": Why Silicon Valley Hates Me and You

https://sightlessscribbles.com/disability-dongle/
24•calcifer•2h ago•4 comments

Civilian plane crash in New Mexico tied to military GPS blocking

https://www.wired.com/story/a-civilian-plane-crashed-in-new-mexico-was-the-militarys-tech-to-blame/
325•dzdt•5h ago•160 comments

Faster Than Ninja

https://build2.org/blog/faster-than-ninja.xhtml
46•elasticdog•3h ago•14 comments

Intelligence Is Not the Main Bottleneck

https://www.writingruxandrabio.com/p/intelligence-is-not-the-main-bottleneck
79•rruxandra_l•2h ago•56 comments

What is distributed Key Generation (DKG)?

https://stoffelmpc.com/stoffel-blog/what-is-distributed-key-generation-(dkg)
4•badcryptobitch•4d ago•0 comments

The next chapter of our AI momentum

https://blog.google/company-news/inside-google/message-ceo/next-chapter-ai-momentum/
10•colesantiago•38m ago•5 comments

Stateless MCP has recaptured my interest

https://simonwillison.net/2026/Jul/31/stateless-mcp/
340•tosh•4d ago•194 comments

TIME Is Serving AI Bots a Different Website, with Ads Built In

https://www.vincentschmalbach.com/time-serves-ai-bots-a-different-website/
165•vincent_s•4h ago•66 comments

Position: LLMs Can't Jump

https://openreview.net/challenge?redirect=%2Fforum%3Fid%3DklU4737opt
169•theanonymousone•5h ago•121 comments

Fed's Kashkari says 'now is the time to start slowly moving' rates up

https://www.cnbc.com/2026/08/05/feds-kashkari-says-now-is-the-time-to-start-slowly-moving-rates-u...
31•mapping365•1h ago•29 comments

Energizing a vacuum-tube flip-flop module from a 1948 IBM system

https://www.righto.com/2026/07/ibm-604-trigger-tube-module.html
18•Jimmc414•4d ago•1 comments

The Law of Jante (2015)

https://www.theparisreview.org/blog/2015/02/11/the-law-of-jante/
7•NaOH•21h ago•0 comments

Not hiring junior engineers won't solve the problem you think you have

https://franciscotrindade.me/blog/the-kids-are-alright/
71•gpi•2h ago•71 comments

Scaling NumPy on Free-Threaded Python

https://labs.quansight.org/blog/scaling-numpy-on-free-threaded-python
74•ngoldbaum•6d ago•11 comments

TSON – A JSON superset with immutable, hash-pinned schemas

https://tson.io/
34•andrewjneumann•2h ago•29 comments