Rust compiler performance
a year ago
- #Rust
- #Programming
- #Compiler Performance
- Rust developers frequently complain about slow compilation times and the slow feedback loop.
- The Rust Project does care about compiler performance, with weekly performance triages, comprehensive benchmarking, and continuous efforts to improve speed.
- Compilation performance has improved significantly over the years, with benchmarks showing up to 1.77x speedup in clean builds.
- Despite improvements, Rust's compilation times are still a bottleneck for many developers, especially compared to languages like Python.
- Achieving near-instant rebuilds in Rust is challenging due to its complex type system, borrow checking, and other features.
- Potential solutions include parallel frontend, alternative codegen backends, smarter incremental compilation, and faster linkers.
- Technical challenges include the complexity of the Rust compiler codebase, trade-offs in optimizations, and maintaining backward compatibility.
- Prioritization is an issue, as the Rust Project must balance performance improvements with stability, new features, and other priorities.
- Contributors to Rust are mostly volunteers with diverse interests, and not all focus on performance optimizations.
- Funding and long-term investment in compiler performance could accelerate improvements, but maintaining contributions is crucial.
- Future initiatives include making LLD the default linker on Linux and running a compiler performance survey to identify bottlenecks.