Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
nnethercote.github.io
Iterators collect and extend Iterator::collect converts an iterator into a collection such as Vec, which typically requires an allocation. You should avoid calling collect if the collection is then only iterated over again. For this reason,...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
Bounds Checks By default, accesses to container types such as slices and vectors involve bounds checks in Rust. These can affect performance, e.g. within hot loops, though less often than you might expect. There are several safe ways to cha...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
I/O
I/O Locking Rust's print! and println! macros lock stdout on every call. If you have repeated calls to these macros it may be better to lock stdout manually. For example, change this code: # let lines = vec!["one", "two", "three"]; for line...
The Rust Performance Book Book 2024-01-01 ~2 min read
nnethercote.github.io
Logging and Debugging Sometimes logging code or debugging code can slow down a program significantly. Either the logging/debugging code itself is slow, or data collection code that feeds into logging/debugging code is slow. Make sure that n...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
Wrapper Types Rust has a variety of "wrapper" types, such as RefCell and Mutex, that provide special behavior for values. Accessing these values can take a non-trivial amount of time. If multiple such values are typically accessed together,...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
Machine Code When you have a small piece of very hot code it may be worth inspecting the generated machine code to see if it has any inefficiencies, such as removable bounds checks. The Compiler Explorer website is an excellent resource whe...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
Parallelism Rust provides excellent support for safe parallel programming, which can lead to large performance improvements. There are a variety of ways to introduce parallelism into a program and the best way for any program will depend gr...
The Rust Performance Book Book 2024-01-01 ~1 min read
nnethercote.github.io
General Tips The previous sections of this book have discussed Rust-specific techniques. This section gives a brief overview of some general performance principles. As long as the obvious pitfalls are avoided (e.g. using non-release builds)...
The Rust Performance Book Book 2024-01-01 ~2 min read
nnethercote.github.io
Compile Times Although this book is primarily about improving the performance of Rust programs, this section is about reducing the compile times of Rust programs, because that is a related topic of interest to many people. The Minimizing Co...
The Rust Performance Book Book 2024-01-01 ~2 min read
nnethercote.github.io
It has been five months since my last general update on the Rust compiler’s performance. Let’s see what has happened in that time. Big wins Let’s start with some big improvements. The information about metrics at the top of this post still...
Observations/Thoughts 2023-08-30 ~11 min read
nnethercote.github.io
Update: see the follow-up post for responses and updated data sets. Are you good at data analysis techniques such as linear regression? Want to help speed up the Rust compiler? Back-end parallelism in rustc Two weeks ago I wrote about my re...
Miscellaneous 2023-07-26 ~4 min read
nnethercote.github.io
This post describes some performance work I have been doing recently on rustc. I spent several weeks on a particular problem with only a small amount of success. I hope a write-up will be interesting and educational, and may even lead to su...
Observations/Thoughts 2023-07-12 ~20 min read
nnethercote.github.io
It’s time to look at some of the progress on Rust compiler speed made since my last post in July. Metrics First, a note about metrics. The rustc benchmark suite uses several different time-related metrics, each of which has its pros and con...
Observations/Thoughts 2022-11-02 ~11 min read
nnethercote.github.io
Like most compilers, rustc (the Rust compiler) has a lexer that breaks source code into tokens, which are small units such as identifiers, literals, operators, and punctuation. The parser then checks that these tokens are present in an orde...
Observations/Thoughts 2022-10-05 ~2 min read
nnethercote.github.io
Let’s look at some of the progress on Rust compiler speed made since my last post. I will start with some important changes made by other people. Windows PGO Profile-guided optimization is a technique for producing faster programs. It has t...
Observations/Thoughts 2022-07-20 ~16 min read
nnethercote.github.io
In my last post I introduced the Compiler performance roadmap for 2022. Let’s see how things are progressing. Normally in these posts I mostly write about my own work, but there is enough interesting stuff going on that I will mention work...
Observations/Thoughts 2022-04-13 ~13 min read
nnethercote.github.io
Between 2016 and 2020 I wrote a series of blog posts called “How to speed up the Rust compiler”. These were mostly about my work on the Rust compiler, plus some updates on the progress on the Rust compiler’s speed in general. I am now back...
Observations/Thoughts 2022-03-02 ~6 min read
nnethercote.github.io
Valgrind is a very useful tool for working with Rust. This may surprise you. Why would a tool for detecting memory errors be useful with a memory safe language? Two reasons: Valgrind is much more than a tool for detecting memory errors, and...
Observations/Thoughts 2022-01-05 ~3 min read
nnethercote.github.io
Update (Dec 10, 2021): I have added some extra information worth reading at the bottom of this post. Update (Feb 25, 2022): And some more. The Rust compiler uses hash tables heavily, and the choice of hash function used for these hash table...
Rust Walkthroughs 2021-12-15 ~10 min read
nnethercote.github.io
I worked on Rust part-time for several years at Mozilla. During that period I regularly summarized how the compiler’s performance had improved. For example: 2017-11-12 to 2019-07-24. The last comparison I did was in August 2020. I had a bre...
Observations/Thoughts 2021-11-17 ~2 min read
""I did not want to inflict memory management on my son" – @M_a_s_s_i"

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.