Live data from Hacker News

The only build system that might someday replace make (2010)

apenwarr.ca

21–30 of 48 posts

Re: The only build system that might someday replace make (2010)

#21
post #9

Earlier quoted context omitted.

Could you talk a bit about your experience? The two points you mentioned feel more like theoretical / principled opinions rather than on the ground experience / issues

Everything feels beta. It crashes on about 10% of our builds with an inscrutable java error deep in the bowels of bazel. The solution, according to the bazel authors, is to rebuild, which works so our ci pipeline has an auto retry mechanism because bazel is so buggy. I’m not joking. On top of a that, everyone on my team had to learn skylark, their rules for docker, their rules for node, their... I’m exhausted just th…

Would it be possible for you to link to the GitHub issue for that crash?

Re: The only build system that might someday replace make (2010)

#24

The biggest problem: "it can do everything make can do" This means it cannot enforce pinning-on-a-hash ('hermetic' builds in bazel lingo): if you allow dev team to say `git clone hxxp://whatever/whatever/master` somewhere in the bowels of the build system, they invariably go for it. It's easy, agile and it works (for months if not years). Result? On a large project, every week you get a build broken by some third-par…

You can run the build in a container without network access. Admittedly, neither make nor redo make it any easier to create such a container, but they don't make it harder, either.

Re: The only build system that might someday replace make (2010)

#25
The overall concept of automatically memoizing parts of a batch computation to turn it into an incremental computation is really interesting, because something like 95% of software amounts to different systems for managing caches. The old saying is that there are two hard problems in software: naming, cache invalidation, and off-by-one errors; and cache invalidation is what we're talking about here.

A difficult issue here is that choosing good caches in a computing system is inherently a global optimization problem. Suppose you're spending 95% of your time in function X, so you memoize function X, with a 90% hit rate, but probing and invalidating the cache, and the extra space it takes up, takes 5% of the time that X took. So your system overall does the non-X (100-95)% = 5% of the work it was originally doing, plus 10% of the X work (9% of the total), plus a new 5% of 95% = 4.75% in the cache; so the system is doing 18.75% as much work as before, so (modulo concurrency) it's a bit over 5× faster.

Working on that remaining 9% of the original that is cache misses invoking X, you notice that X is spending 99% of its time in several calls to, indirectly, another function Y, so you memoize Y, and this works out better: you have a 95% hit rate, and managing and probing the Y cache only takes 1% of the work that running Y took. So the 8.91% of the original runtime that was in Y is reduced to 0.0891% of the original in cache management, plus 0.4455% of the original runtime in the cache misses in Y, for a total of 0.5346% of the original runtime, so you've reduced the runtime from 18.75% of the original to 10.3746% of the original; you've almost doubled performance again by adding this other cache.

But you're still spending 4.75% of the original runtime managing the X cache. Now you can improve performance by removing the X cache. Originally you were spending 94.05% of the runtime in Y (although you didn't know it) which you can reduce to 4.7025% in misses on the Y cache, plus 0.9405% in Y-cache management, plus the 5% of the original runtime that wasn't in X, for 9.7025% of the original runtime.

So you quintupled performance by memoizing X, and then later you improved performance by 6.5% by undoing the memoization of X. And this is in a very simple model system which doesn't take into account things like the memory hierarchy (another kind of caching), space budgets, and cache miss rates varying across different parts of the system.

So we have a global optimization problem which we are trying to solve by making local changes to improve things. This is clearly not the right solution, but what is?

Umut Acar described an aproach he calls "self-adjusting computation" which uses a single global caching/memoization system within a program to do fine-grained cache invalidation. His student Matthew Hammer has extended this work. I haven't figured out how their system works yet, but it seems like a promising start.

The topic topics/caching.html in Dercuano collects a bunch of notes on this topic more generally: http://canonical.org/~kragen/dercuano-20191110.tar.gz.

I really appreciate Raph posting the link to the Mokhov–Mitchell–Peyton-Jones paper in https://news.ycombinator.com/item?id=21617434.

Re: The only build system that might someday replace make (2010)

#26
post #11

This gave me a weird déjà vu of reading about some software that solves all the problems elegantly and performantly and that I've never otherwise seen and will forget in a day. The other software might've been a build system too.

It might have even been this build system. This has been coming up off and on for many years.

Re: The only build system that might someday replace make (2010)

#28
post #24

The biggest problem: "it can do everything make can do" This means it cannot enforce pinning-on-a-hash ('hermetic' builds in bazel lingo): if you allow dev team to say `git clone hxxp://whatever/whatever/master` somewhere in the bowels of the build system, they invariably go for it. It's easy, agile and it works (for months if not years). Result? On a large project, every week you get a build broken by some third-par…

You can run the build in a container without network access. Admittedly, neither make nor redo make it any easier to create such a container, but they don't make it harder, either.

Blaze-like systems offer other benifits over makefiles that are, in their own right, amazing.

1. Distributing modules with BUILD files makes everything just work

2. You don't think at the level of commands/files, you think at the abstraction of targets. How targets happen in an implementation detail.

3. `select` for varying builds in a sane and readable way

4. Shared cache

5. Distributed build and test runner

6. Query language

7. All builds occur out of tree

8. A language for describing builds that doesn't feel obtuse

And the list keeps going on. A "new make" is not an improvement. It is likely where the world is going to go it just misses out on obvious benefits of other build systems.

Re: The only build system that might someday replace make (2010)

#29

From my recent Twitter mentions: Build Systems à la Carte (2018). This presents a theoretical analysis of build systems (which they have defined broadly enough to include Microsoft Excel) and how to pick and choose the various properties they provide. This came up because I am promoting a conceptually similar unified theory of Reactive UI, which also has things in common with build systems. In fact, Svelte also happe…

Have you considered making a compiler plugin for Rust so Svelte style GUIs are possible? Reactivity should have first class support just like concurrency (which too have a runtime).

Re: The only build system that might someday replace make (2010)

#30
post #24

Earlier quoted context omitted.

You can run the build in a container without network access. Admittedly, neither make nor redo make it any easier to create such a container, but they don't make it harder, either.

Blaze-like systems offer other benifits over makefiles that are, in their own right, amazing. 1. Distributing modules with BUILD files makes everything just work 2. You don't think at the level of commands/files, you think at the abstraction of targets. How targets happen in an implementation detail. 3. `select` for varying builds in a sane and readable way 4. Shared cache 5. Distributed build and test runner 6. Quer…

All those things could be done with redo with varying degrees of effort.
Post reply on HN