Rust Compilation Performance Survey: 2025 Results Reveal Developers’ Biggest Pain Points

Introduction

For Rust developers, compilation speed has always been a major concern. In September of this year, the Rust compiler performance working group released the results of the first Rust compiler performance survey, with over 3,700 developers participating. This report not only reveals the main challenges Rust developers face regarding build performance but also proposes a series of ongoing or planned improvements. This article summarizes the key findings and future outlook of this survey.

Overall Satisfaction

The survey shows that the average satisfaction of developers with Rust’s compilation performance is 6 out of 10, with most giving a score of 7. However, this result varies significantly among different users and workflows. Some developers report that Rust’s build performance is better than C++, while others believe it still lags behind languages like Go or Zig. Notably, about 45% of respondents who no longer use Rust indicated that long compilation times were one of the reasons for abandoning it.

Main Workflow Pain Points

1. Incremental Rebuilds

Incremental rebuilds are the most common complaint in the survey, with 55% of respondents reporting that their rebuild wait times exceed 10 seconds. The main issues include:

  • Workspace changes trigger unnecessary rebuilds: Modifying a dependency library requires all libraries that depend on it to be recompiled.
  • Slow linking phase: Linking always starts from scratch and cannot be executed incrementally.
  • Slow incremental rebuild speed for individual crates: Although the compiler has an incremental engine, certain compilation processes fail to cache effectively.

The size of the project and the number of dependencies significantly affect rebuild times. Large projects (over 500,000 lines of code) or projects with many dependencies (over 300 dependencies) have noticeably longer rebuild times.

2. Type Checking and IDE Performance

About 60% of respondents use terminal commands for type checking, building, or testing code, with <span>cargo check</span> being the most commonly used command after code modifications. The main issues are:

  • <span>cargo check</span> does not share build cache with <span>cargo build</span>.
  • 87% of developers use inline annotations in their editors to view compilation errors, but about 33% believe that waiting for these annotations to appear is a significant hindrance.
  • The performance and memory usage of Rust Analyzer are also common limiting factors.

3. Full Builds and CI Builds

About 20% of participants consider full builds to be a major obstacle. CI build performance is a primary issue for 25% of respondents, and surprisingly, nearly 36% of those who consider CI build performance a major problem reported that they do not use any CI caching. The reason may be that the generated artifacts (target directory) are too large, exceeding the usage limits of CI providers.

Impact of Debug Information

By default, Cargo’s development configuration generates full debug information for workspace crates and all dependencies. This allows for step-by-step execution of code using a debugger but also increases disk usage in the target directory and slows down compilation and linking. Benchmarking shows that reducing the debug information level to line-tables-only could yield a 2-30% improvement in cycle counts.

Interestingly, the survey revealed that 53.7% of respondents never or rarely use a debugger, but when asked about the need for default debug information generation, the responses were less clear: 32.6% prefer to reduce default debug information to speed up compilation, 32.1% want full debug information generated by default, and 35.3% only need full debug information for their own code, not for dependencies.

Workarounds to Improve Build Performance

The most popular and effective mechanisms for improving build performance include: reducing the number of dependencies, minimizing enabled features, and splitting large crates into smaller ones. Using alternative linkers is also a common optimization method that does not require source code modifications, with mold and LLD linkers being particularly popular.

The good news is that in the upcoming stable version of Rust, the most popular x86_64-unknown-linux-gnu Linux target will default to using the LLD linker, which will significantly improve linking speed.

The survey found that many users are unaware of simple methods to improve compilation time, such as reducing debug information or using different linkers. Nearly 42% of respondents had not tried any mechanisms to improve build performance. To address this, the Rust team is creating an official build performance optimization guide, which may be hosted in the Cargo book.

Understanding the Causes of Slow Builds

When Rust developers encounter slow builds, it can be challenging to determine where time is being spent in the compilation process and what the potential bottlenecks are. The survey shows that very few Rust developers utilize tools to analyze their builds:

  • Only 18.93% use <span>cargo build --timings</span>
  • Only 6.13% of developers use the compiler’s own analyzer (<span>-Zself-profile</span>).
  • 5.40% use compiler pass timing analysis (<span>-Ztime-passes</span><code><span>).</span>
  • 6.13% of developers use LLVM function instantiation analysis (<span>cargo-llvm-lines</span>).

The Rust team recently added support for displaying link times in the output of <span>cargo build --timings</span><span>,</span> <span>to provide more information about potential bottlenecks in crate compilation (note that this feature is not yet stable).</span>

Future Outlook

While the Rust compiler is becoming faster each year, the Rust team understands that many developers need significant improvements to enhance their productivity, rather than just incremental performance gains. The Rust team’s goal is to stabilize long-term plans that could greatly improve build performance, such as the Cranelift code generation backend or a parallel compiler frontend.

There are also other ambitious ideas to reduce (re)build times, such as avoiding unnecessary workspace rebuilds or using some form of incremental linking, but these require substantial work and design discussions. These changes necessitate a lot of effort, domain knowledge (which takes a relatively long time to acquire), and many discussions and code reviews, and there are very few people with the time and motivation to handle or review these changes.

Practical Tips

If you are struggling with the compilation performance of your Rust project, consider trying the following methods:

1. Reduce the Number of Dependencies and Enabled Features

# Cargo.toml

[dependencies]
# Use optional features, enable as needed
tokio = { version = "1.35.1", features = ["rt"], optional = true }
serde = { version = "1.0.197", features = ["derive"], optional = true }

[features]
# Define feature sets, grouping related dependencies
dasync = ["tokio", "serde"]

2. Use a Faster Linker

On Linux, you can configure in <span>.cargo/config.toml</span><span>:</span>

# .cargo/config.toml

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

3. Reduce Debug Information to Speed Up Development Builds

# Cargo.toml

[profile.dev]
debug = 1  # Generate only line table debug information, not full debug information

4. Use Build Performance Analysis Tools

To analyze build times, you can use:

# View compilation times for each crate
cargo build --timings

# Use more detailed compiler analysis in nightly version
cargo +nightly rustc -- -Zself-profile

Conclusion

The Rust compiler performance survey reveals the main challenges developers face: slow incremental rebuilds, unnecessary rebuilds triggered by workspace changes, slow linking phases, and IDE performance issues. The Rust team is taking multiple measures to address these issues, including defaulting to a faster linker, improving debug information generation strategies, optimizing Rust Analyzer performance, and creating an official build performance optimization guide.

While significant improvements in compilation performance will take time and resources, the Rust team is committed to continuous improvement to make the Rust development experience smoother. As developers, we can also optimize our project’s build performance by adopting best practices such as reducing dependencies, using faster linkers, and adjusting debug information levels.

References

  1. Rust compiler performance survey 2025 results: https://blog.rust-lang.org/2025/09/10/rust-compiler-performance-survey-2025-results/

Book Recommendations

The second edition of the Chinese version of “The Rust Programming Language” is an authoritative learning resource written by the Rust core development team and translated by members of the Chinese Rust community. It is suitable for all software developers who wish to evaluate, get started, improve, and study the Rust language, and is regarded as essential reading for Rust development work.

This book introduces the fundamental concepts of the Rust language to practical tools in a gradual manner, covering advanced concepts such as ownership, traits, lifetimes, and safety guarantees, as well as practical tools like pattern matching, error handling, package management, functional features, and concurrency mechanisms. The book includes three complete project development case studies, guiding readers from zero to developing practical Rust projects.

Notably, this book has been updated to include content from the Rust 2021 edition, meeting the systematic learning needs of beginners and serving as a reference guide for experienced developers, making it the best entry point for building solid Rust skills.

Recommended Reading

  1. Rust: The Performance King Sweeping C/C++/Go?

  2. A C++ Perspective from Rust Developers: Revealing Pros and Cons

  3. Rust vs Zig: The Battle of Emerging System Programming Languages

  4. Essential Design Patterns for Rust Asynchronous Programming: Enhance Your Code Performance and Maintainability

Leave a Comment