119 points · by signa11 · 1y ago · 22 comments
For those interested in more details, we published a paper about it in OOPSLA'16 [1].
(Although as the language complexity continues to grow maybe that question is missing the opposite force of compiler slowdowns from added work?)
- https://internals.rust-lang.org/t/slow-incremental-compilati...
- https://internals.rust-lang.org/t/feedback-request-performan... (there is more context to that being published today in a blog post)
There are several more ideas that are in even earlier stages of discussion.
Your question is addressed in this blog post - Faster compilation with the parallel front-end in nightly (https://blog.rust-lang.org/2023/11/09/parallel-rustc.html). One the example shown there:
- Serial took 10.2 seconds in the frontend and 6.2 seconds in the backend.
- Parallel tool 5.9 seconds (-42%) and 5.3 seconds (-14.5%).
So to answer your question, parallelising the frontend can have a substantial impact.
You are right that frontend is only a subset of the total compilation time - backend and linking time matter too. Happily, that's something that's being worked on too!
There is an alternate backend called cranelift (https://bjorn3.github.io/2024/11/14/progress-report-nov-2024...) that compiles faster than LLVM, at the cost of producing slower binaries. That's a good trade-off for debug builds.
And there's work on changing the default linker to lld (https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-l...).
We may see all 3 efforts land in the next year :)
In particular, we're actively implementing a simpler Salsa [3] and transform the currently-batch-mode compiler into an incremental, pull compiler.
[1] https://isograph.dev/docs/design-docs/incremental-compilatio...
We don't share the query infrastructure in rust-analyzer, but rust-analyzer is a query-driven system. We use Salsa (https://github.com/salsa-rs/salsa/), which is strongly inspired by rustc's query system, down to the underlying red/green algorithm (https://rustc-dev-guide.rust-lang.org/queries/incremental-co...), hence the name: Salsa.
Build systems.
Now compiler passes.
Container layers.
Also in ML systems, eg dvc.
Where else is it missing?