Next steps for reducing overall compilation time

One thing I’ve been thinking recently in terms of long term planning and high level ideas is to explore better cached and distributed compilation with rustc. The more adoption we get the more this tends to come up where it may be one of the next “low ish hanging fruit” for big perceived wins in compilation speed.

This is along the lines of sccache which has made some great strides in this area but I’d like to be more ambitious about running sccache on remote machines and running compilations across a cluster instead of always centralized on one machine.

Most of this work won’t actually go into rustc itself, but I worry that rustc makes it difficult, today at least, to enable this work. For example we can’t architecturally parallelize compilation of one crate across many machines. We also can’t easily kick off compilations of downstream crates once metadata is ready, even though that’s all it needs to proceed. Finally the story for incremental in rustc doens’t integrate well with sccache-like strategies or otherwise external caches.

I think it’d be awesome if we could take a look at the possibilities here and see what capabilities need to be added to rustc to enable these sort of compilation schemes, and then once the tools are in place we could work in parallel externally on tools like sccache to leverage rustc’s new capabilities

9 Likes