Hasty Briefsbeta

How to speed up the Rust compiler in December 2025

6 days ago
  • #Rust
  • #Performance
  • #Compiler Optimization
  • Optimized VecCache data structure for densely-numbered IDs, yielding up to 4% icount reductions.
  • Added fast path for lowering trivial consts, reducing libc crate compile times by 5-15%.
  • Avoided unnecessary computation in debug! calls, achieving over 3% icount reductions.
  • Optimized temporary scope handling, reducing icounts by 3% and peak memory usage by 5%.
  • Upgraded LLVM to version 21, resulting in mean icount reduction of 1.70% but mixed wall-time results.
  • Reimplemented format_args!() for space efficiency, with up to 38% icount wins in stress tests.
  • Introduced -Zmacro-stats to measure macro-generated code, optimizing Bevy's #[derive(Reflect)] by 39%.
  • Reduced allocations in rustdoc-json, improving wall-time by up to 10% and memory usage by 8%.
  • Proposed a performance-oriented format for rustdoc-json to aid heavy-duty tools.
  • Introduced -Zhint-mostly-unused flag for faster compilation of large API crates.
  • Highlighted a macOS setting that can speed up Rust builds.
  • Reported overall wall-time improvements (-3.19% and -2.65%) despite mixed other metrics.