Story Details

  • Cutting down Rust compile times from 30 to 2 minutes with one thousand crates

    Posted: 2025-04-17 11:22:17

    Feldera drastically reduced Rust compile times for a project with over a thousand crates from 30 minutes to 2 minutes by strategically leveraging sccache. They initially tried using a shared volume for the sccache directory but encountered performance issues. The solution involved setting up a dedicated, high-performance sccache server, accessed by developers via SSH, which dramatically improved cache hit rates and reduced compilation times. Additionally, they implemented careful dependency management, reducing unnecessary rebuilds by pinning specific crate versions in a lockfile and leveraging workspaces to manage the many inter-related crates effectively.

    Summary of Comments ( 48 )
    https://news.ycombinator.com/item?id=43715235

    HN commenters generally praise the author's work in reducing Rust compile times, while also acknowledging that long compile times remain a significant issue for the language. Several point out that the demonstrated improvement is largely due to addressing a specific, unusual dependency issue (duplicated crates) rather than a fundamental compiler speedup. Some express hope that the author's insights, particularly around dependency management, will contribute to future Rust development. Others suggest additional strategies for improving compile times, such as using sccache and focusing on reducing dependencies in the first place. A few commenters mention the trade-off between compile time and runtime performance, suggesting that Rust's speed often justifies the longer compilation.