I was thinking: currently, we make builds available for every PR that lands over the last 90 days. That’s great for bisecting things. But it’d be even better if we could use those builds as “starting points” for ordinary development – that is, it’d be really cool if those builds could include incremental state (codegen units + hashes, etc) that we could then download and use when building. This would help people getting started to have faster rustc builds.
I’m sure this idea is kinda challenging to do – and probably not the lowest hanging fruit – but it’s maybe worth keeping in mind.
I’d imagine that something like this is definitely eminently possible! There’s certainly a lot of things to do along the way but a lot of the fundamental tools I believe are there for this.
Like @qmx I’d imagine that sccache is probably the best way to start here. That’s already got built-in support for Rust and has existing ideas for tiers of caching. Something like that would I think greatly accelerate compilation of anything that you haven’t changed (aka everything up to librustc).
Now the next thing we’d encounter is how to accelerate compiles of code you’ve modified, but only a little bit. Presumably you can reuse a lot of the upstream artifacts that bors is generating (if bors compiled in incremental mode). We could postulate, however, that sccache could be enhanced to cache incremental compilation directories as well have and have a more relaxed cache key so you’d download probably-stale artifacts where at least some could be reused.
The next problem may then be that a compiler compiled incrementally doesn’t have great performance! Incremental compilation right now doesn’t have ThinLTO so no inlining happens across codegen units which can be quite a hit to perf. I’ve just now opened a tracking issue, though, for enabling ThinLTO with incremental compilation. It’s explicitly designed to be incremental so we should try to get some of those benefits!
At this point we’d actually be quite far along and have a whole slew of problems that I wouldn’t be able to anticipate. It’d be awesome to get here though!
At the very least I think that enabling sccache on @bors for rustc compiles in stage0 would be a great idea. Once sccache implements multi-tiered caching then we’d instantly have accelerated stage0 builds, and we could figure out how to get faster incremental builds down the road too.