nnethercote.github.io
My last post on the Rust compiler’s performance was two months ago and a lot has happened since then. Overall progress The measurements for the period 2026-07-29 to 2026-09-28 can be seen here. The mean wall-time reduction was 4.57%, which...
Rust Walkthroughs
2026-09-30
~5 min read
nnethercote.github.io
My last post on the Rust compiler’s performance was in December 2025. Let’s see what has happened since then. Overall progress The measurements for the period 2025-12-03 to 2026-07-29 can be seen here. The mean wall-time reduction was a hea...
Observations/Thoughts
2026-08-05
~7 min read
nnethercote.github.io
nnethercote.github.io Topics: Compiler performance, profiling, optimization Why RustGrep includes it: Made rustc ~2.5x faster. The Rust Performance Book. Categories: educator, compiler, performance
Blog
2026-07-27
~1 min read
nnethercote.github.io
It has been more than six months since my last post on the Rust compiler’s performance. In that time I lost one job and gained another. I have less time to work directly on the Rust compiler than I used to, but I am still doing some stuff,...
Rust Walkthroughs
2025-12-10
~6 min read
nnethercote.github.io
Did you know that macOS has a secret setting that can make Rust builds faster? It can also make Rust tests faster (sometimes massively so). It probably even has similar effects for other compiled languages such as C, C++, Go, and Swift. It...
Rust Walkthroughs
2025-09-03
~6 min read
nnethercote.github.io
If you are using #[derive(Arbitrary)] to fuzz your Rust code, update the Arbitrary crate to v1.4.2 to get some compile time reductions and possibly some fuzzing speed improvements. You can update with the command cargo update -p arbitrary -...
Observations/Thoughts
2025-08-20
~2 min read
nnethercote.github.io
Rust’s proc macros are powerful but tricky, and have some compile-time costs. This post is about a new tool to help quantify and reduce some of those costs. Proc macro costs There are several ways proc macros affect compile times. The time...
Observations/Thoughts
2025-07-02
~7 min read
nnethercote.github.io
It has been just over a year since my last update on the Rust compiler’s performance. Let’s get into it. The information about metrics at the top of this post still applies. Notable improvements #124129: In this PR, Rémy Rakic made lld the...
Observations/Thoughts
2025-03-19
~6 min read
nnethercote.github.io
Sometimes I pick a crate in the Rust compiler and read through its code to learn about it and find things that I can improve. Often the improvements are small, but sometimes they snowball. One example involved the rustc_errors crate. rustc...
Observations/Thoughts
2024-12-25
~11 min read
nnethercote.github.io
The Rust Performance Book First published in November 2020 Written by Nicholas Nethercote and others Source code
The Rust Performance Book
Book
2024-01-01
~1 min read
nnethercote.github.io
Introduction Performance is important for many Rust programs. This book contains techniques that can improve the performance-related characteristics of Rust programs, such as runtime speed, memory usage, and binary size. The Compile Times s...
The Rust Performance Book
Book
2024-01-01
~1 min read
nnethercote.github.io
Benchmarking Benchmarking typically involves comparing the performance of two or more programs that do the same thing. Sometimes this might involve comparing two or more different programs, e.g. Firefox vs Safari vs Chrome. Sometimes it inv...
The Rust Performance Book
Book
2024-01-01
~1 min read
nnethercote.github.io
Build Configuration You can drastically change the performance of a Rust program without changing its code, just by changing its build configuration. There are many possible build configurations for each Rust program. The one chosen will af...
The Rust Performance Book
Book
2024-01-01
~12 min read
nnethercote.github.io
Linting Clippy is a collection of lints to catch common mistakes in Rust code. It is an excellent tool to run on Rust code in general. It can also help with performance, because a number of the lints relate to code patterns that can cause s...
The Rust Performance Book
Book
2024-01-01
~1 min read
nnethercote.github.io
Profiling When optimizing a program, you also need a way to determine which parts of the program are "hot" (executed frequently enough to affect runtime) and worth modifying. This is best done via profiling. Profilers There are many differe...
The Rust Performance Book
Book
2024-01-01
~3 min read
nnethercote.github.io
Inlining Entry to and exit from hot, uninlined functions often accounts for a non-trivial fraction of execution time. Inlining these functions removes these entries and exits and can enable additional low-level optimizations by the compiler...
The Rust Performance Book
Book
2024-01-01
~2 min read
nnethercote.github.io
Hashing HashSet and HashMap are two widely-used types and there are ways to make them faster. Alternative Hashers The default hashing algorithm is not specified, but at the time of writing the default is an algorithm called SipHash 1-3. Thi...
The Rust Performance Book
Book
2024-01-01
~2 min read
nnethercote.github.io
Heap Allocations Heap allocations are moderately expensive. The exact details depend on which allocator is in use, but each allocation (and deallocation) typically involves acquiring a global lock, doing some non-trivial data structure mani...
The Rust Performance Book
Book
2024-01-01
~12 min read
nnethercote.github.io
Type Sizes Shrinking oft-instantiated types can help performance. For example, if memory usage is high, a heap profiler like DHAT can identify the hot allocation points and the types involved. Shrinking these types can reduce peak memory us...
The Rust Performance Book
Book
2024-01-01
~4 min read
nnethercote.github.io
Standard Library Types It is worth reading through the documentation for common standard library types—such as Vec, Option, Result, and Rc/Arc—to find interesting functions that can sometimes be used to improve performance. It is also worth...
The Rust Performance Book
Book
2024-01-01
~2 min read