16 Nov 2026

feedPlanet Mozilla

The Rust Programming Language Blog: Enabling the parallel frontend on nightly

TL;DR: We are enabling the parallel frontend of the Rust compiler on nightly by default, to find remaining issues in preparation for its stabilization.

Context

The Rust compiler has been using multiple threads to compile code in its "backend" part (using LLVM) for a long time. However, its "frontend" part (which includes type checking and borrow checking) has been executing sequentially, on a single thread, which of course limits the performance of the compiler. If you are interested in a more in-depth explanation of parallelism in the Rust compiler, see this previous post.

The compiler frontend actually had support for running in parallel for a long time, but it was not enabled by default due to various issues. Three years ago, we made it possible to opt into the parallel frontend on the nightly channel, with the plan to stabilize it in 2024. Clearly, we did not achieve that goal, but work on the parallel frontend was still slowly progressing in the meantime.

Last year, Vadim Petrochenkov, together with several other contributors, started a coordinated effort to finally get the parallel frontend over the finish line. Since then, many long-standing issues were fixed, and its performance was improved. Now we are at a point where we would like to make it widely available. But before that, we want to find out if people encounter issues with it in the wild, which is why we are enabling it by default only on the nightly channel. Once we will be confident enough that it is working well, we want to stabilize it.

The parallel frontend has been enabled on the nightly channel by default since nightly-2026-11-14.

Benefits

The primary benefit of enabling the parallel frontend is, of course, faster compilation of Rust programs.

We benchmarked the parallel frontend in our benchmark suite, which measures the duration to compile the leaf crate in a crate graph. As usual, the results were varied. In some benchmarks, the parallel frontend barely helped. In others, for example when performing a cargo check of the nalgebra, cargo or diesel crates, the compilation was almost three times faster, using 8 threads.

In the table below, you can find the aggregated wall-time mean change for the real-world benchmarks in our suite, when building a single crate from scratch across several configurations, compared to the same build using a sequential frontend.

Frontend threads / Profile check clippy debug opt
2 -21.95 % -20.74 % -14.2 % -12.51 %
4 -37.99 % -36.01 % -29.14 % -23.67 %
8 -44.23 % -41.76 % -36.1 % -27.88 %

It is clear that the parallelization is not perfect, and we definitely plan to invest more effort into improving its performance. Nevertheless, with 8 threads, it can make the end-to-end compilation time of cargo check ~2x faster for several crates that we tested, which is still quite an improvement.

The performance benefits for incremental rebuilds are much more modest, and also very hard to compare, because the performance of rebuilds depends on what was changed and how were the codegen units laid out. In our benchmark suite, we saw a mean improvement of 3-5% for incremental rebuilds. But we currently do not have great benchmarks for this use-case, so your results might vary.

We can also zoom in on an individual crate. Here is a chart of how the wall-time scales when compiling the nalgebra 0.33 crate, for a full non-incremental build (full), full incremental build (incr-full) and an incremental rebuild (incr-patched) across several build configurations:

Nalgebra benchmark results

What is interesting to note is that enabling the parallel frontend can actually also make the backend faster, for reasons explained here.

It is important to note that all benchmark results presented above measured only the compilation of a single crate. When compiling a whole crate graph, your CPU cores might already be saturated because of backend (LLVM) parallelism or by Cargo compiling multiple crates in parallel. So the final performance effect will vary heavily based on the workload that you are running, and on the number of cores that you have available.

We also benchmarked cargo check end-to-end (checking the whole crate graph) on the cargo crate itself on a machine with 8 CPU cores. With 8 threads, it resulted in a ~15% end-to-end improvement:

As can be seen from the results above, when the CPU cores are already saturated with parallel crate compilation and LLVM, the positive effect of the parallel frontend is reduced.

Tuning the thread count

At the start, the nightly toolchain will default to the parallel frontend using only 2 threads. This is a conservative choice that should still allow us to find potential issues while not increasing memory usage a lot at the same time.

If you want to test out the performance with different thread counts, you can override the number of threads used for the frontend using the --jobs-frontend compiler flag. It can be specified either in the RUSTFLAGS environment variable, or you can put it into a .cargo/config.toml file:

[build]
rustflags = ["-Zunstable-options", "--jobs-frontend=8"]

Currently, the performance of the parallel frontend will likely not scale very well above ~8 threads, but you can try it on your workload to test what happens. Note that using higher thread counts will likely lead to higher memory usage of the compiler, and in extreme cases it might cause you to run out of memory.

Limitations and known issues

Due to the used parallelism, the produced order of diagnostics might not be deterministic when using the parallel frontend.

In some situations, the generated binary might also not be reproducible, though we currently consider these cases bugs, and we would like to identify them and fix them.

There are currently some known issues related to the reproducibility of the Rust compiler when using the parallel frontend, which are being worked on.

How do I opt out?

To reiterate: this is only being enabled on nightly for now. If you are using the stable toolchain, you will still be using the sequential frontend by default.

If you want to disable the parallel frontend on the nightly channel, pass -Zunstable-options --jobs-frontend=1 to rustc, either via the RUSTFLAGS environment variable, or with the .cargo/config.toml configuration file:

[build]
rustflags = ["-Zunstable-options", "--jobs-frontend=1"]

If you have to do this for some reason, please do tell us why on GitHub or on Zulip. We would especially like to know about any compiler crashes that you encounter, or the produced binaries not being reproducible when the parallel frontend is enabled.

What's next?

Over the next few months, we will be monitoring GitHub and Zulip for any reported issues about the parallel frontend. Once we have enough confidence that it is working well, and there are no major issues, we would like to move forward and finally stabilize it.

We would also like to improve its performance, and make more things parallel. So far, a lot of the work on the parallel frontend has been focused on making it work correctly, rather than tuning its performance down to the last percent. We thus expect that we might still be able to make further performance improvements to it.

We would also like to make more parts of the frontend actually parallel, as some parts are currently still sequential even if parallelism is enabled. There is some ongoing work on this. Last year, we had a Google Summer of Code project focused on enabling parallel macro expansion and name resolution, and there is also an open pull request for parallelizing the lowering of the Abstract Syntax Tree (AST) to the High-Level Intermediate Representation (HIR). More work remains to be done on this front.

16 Nov 2026 12:00am GMT

12 Nov 2026

feedPlanet Mozilla

Firefox Tooling Announcements: MozPhab 2.25.0 Released

Bugs resolved in Moz-Phab 2.25.0:

Discuss these changes in #engineering-workflow on Slack or #Conduit Matrix.

1 post - 1 participant

Read full topic

12 Nov 2026 11:49pm GMT

Firefox Tooling Announcements: Happy BMO Push Day! (20261112.1)

Github Link

The following changes have been pushed to bugzilla.mozilla.org:

Discuss these changes in the BMO Matrix Room

1 post - 1 participant

Read full topic

12 Nov 2026 11:25pm GMT