How to make Firefox builds 17% faster (blog.farre.se)

by mbitsnbites 37 comments 204 points
Read article View on HN

37 comments

[−] mmastrac 31d ago
Can you (err... buildcache) cache Rust proc-macros? I've been battling this with sccache and I'm now maintaining a 10-patch deep stack for the next.js build CI.

Windows builds were ridiculously poor on cache hits rates too because of non-determinism that was not able to figure out.

I'd be happy to test it out.

[−] estebank 31d ago
There was an experimental PR that treats proc macros as idempotent with the corresponding colpike speed up. I don't know what happened with it, and stabilization required a lot of design work to not break backcompat. But this is something in the team's radar.
[−] staticassertion 31d ago
Would it be possible to do somethign like editions for proc macros, or have crates establish "this is a v2 proc macro" or something? There are a lot of things I'd love to see change in a v2 but it'd all be breaking.
[−] estebank 31d ago
Yes, I think here are workable designs.
[−] mmastrac 31d ago
Do you have a link for this one? Would love to see it.
[−] estebank 31d ago
This is not the one I remember but another one that does part of what I'm describing.

https://github.com/rust-lang/rust/pull/145354

[−] NooneAtAll3 31d ago
what do you mean by idempotent and colpike?
[−] estebank 31d ago
Idempotent as in if the token stream in the input doesn't change, the cached result of the previous macro expansion is used during incremental, instead of being pessimistic and rerunning the macro.

Colpike as in compile typo.

[−] evmar 31d ago
I’m not too familiar with Firefox builds. Why are clobber builds common? At first glance it seems weird to add a cache around your build system vs fixing your build system.
[−] jagged-chisel 31d ago
Define “fixing.” If you’re building on ephemeral containers, an external cache is necessary for files that don’t change.
[−] mbitsnbites 31d ago
Though I'm not actively working with Firefox so can't speak for their use cases, one important use case for clobber builds is CI.

I'm the author of BuildCache, and where I work we make thousands of clobber builds every day in our CI. Caching helps tremendously for keeping build times short.

There are a few use cases for local development too. For instance if you switch between git branches you may have to make near full rebuilds (e.g. in C++ if some header file is touched that gets included by many files).

Another advantage as a local dev is that you can tap into the central CI cache and when you pull the latest trunk and build it, chances are that the CI system has already built that version (e.g. as part of a merge gate) so you will get cache hits.

[−] secondcoming 31d ago
What even is a 'clobber build'?
[−] allenrb 31d ago
I guess “purge 17% of the code” is not the correct answer?
[−] K0IN 31d ago
wow, 17% is impressive with such an easy fix. i wonder if we could just build this as a separate project and pull the webidl files as a dependency.
[−] Devorlon 31d ago
Why compile code when ccache faster
[−] butz 31d ago
Disable all AI integrations? Sorry, I'll see myself out.
[−] shevy-java 31d ago
So ... perhaps Mozilla should focus on user share dropping.

I understand that speed is relevant, but focusing on that strategy does not really work when dinosaur-like extinction is around the corner.