How to speed up the Rust compiler in July 2026

2026年7月31日

AI 摘要 AI 生成,可能有误

这份2026年7月的Rust编译器性能更新报告显示,自2025年12月以来平均墙钟时间缩短了5.59%,这主要得益于rustdoc性能提升了37.92%(源于经过优化的impl处理、PGO训练以及更快的impl排序),以及通过消除无操作(no-op)虚拟分派调用为Clippy带来的大幅提速。额外的提升来自增量编译方面的微调、AST节点体积的缩减,以及trait求解器取得的重大新进展——其中一项基准测试的耗时从27秒降至1秒以内——新成员xmakro和arya dradjica为此做出了显著贡献。作者还向每周性能分类(triage)团队表达了感谢,并分享了个人近况:他将离开在VectorWare的工作,转而从事有偿的Rust编译器开发工作。

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.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Nicholas Nethercote

How to speed up the Rust compiler in November 2026

AI 摘要The article reviews a month of Rust compiler performance work, highlighting a new span compression scheme that cut interning to ~1% for incremental builds and reduced instruction counts by up to 3%+, along with a dozen micro-optimizations that lowered the new trait solver's overhead on Diesel from 1.49x to 1.16x. Other changes included removing the AttrTokenStream types, avoiding type variables in large vec literals, and sparse metadata encoding that shrank metadata by up to 37% and peak memory by up to 7%. Overall, the period saw a 2.85% mean wall-time improvement and a 4.46% mean max-RSS reduction, with 560 of 561 instruction-count measurements since the start of the year showing improvements.

How to speed up the Rust compiler in September 2026

AI 摘要The article reports that the Rust compiler achieved a mean wall-time reduction of 4.57% between late July and late September 2026, with 555 of 629 benchmarks improving. Key contributors included enabling PGO for Clippy, upgrading to LLVM 23, optimizations for the new Polonius Alpha borrow checker and new trait solver, and numerous improvements from contributors like xmakro and the author, including a ~30% speedup for cranelift-codegen via a new CFG traversal algorithm. The author also notes they will soon start working at Hexcat on compiler performance optimization.

How to speed up the Rust compiler in December 2025

AI 摘要This article reviews recent Rust compiler performance improvements as of December 2025, including optimizations like a fast path for lowering trivial consts (speeding up the libc crate by 5-15%), a more space-efficient reimplementation of format_args!(), an LLVM 21 upgrade, and reduced allocations in rustdoc-json. It also describes efforts to streamline code generated by the #[derive(Reflect)] proc macro in Bevy, cutting generated code size by 39% and compile times by 16%. Overall, mean wall-times improved by about 2.65-3.19% since May, with other metrics like memory usage and binary size showing mixed results.

My new job

AI 摘要The author announces they have joined VectorWare, a startup aiming to improve GPU programming with Rust, in a role that involves open source and some Rust compiler work while they remain a Rust compiler team member and maintainer. They clarify that speculation about their delayed announcement was unfounded—the wait was due to paperwork—and that they received interest from many employers, demonstrating Rust's adoption across a remarkably wide range of industries. They close by thanking everyone who helped during their job search.

Faster Rust builds on Mac

AI 摘要macOS's XProtect antivirus feature scans every newly compiled executable for malware, which significantly slows down Rust build scripts, cargo run cycles, and especially test suites that launch many small binaries—for example, the Rust compiler's tests/ui suite dropped from 9m42s to 3m33s when XProtect was disabled. The workaround is to add Terminal as a 'developer tool' in System Settings, though this disables an OS security feature. A draft PR for Cargo would detect when XProtect is enabled and warn users about its performance impact, helping spread awareness of this little-known trade-off.