conv.

All stories
TechQuiet 70d · day 78

Rustdoc developer achieves 33% speedup through performance optimization

Noah Lev of the Rustdoc team discovered and fixed inefficient trait impl inlining that was causing stack overflows and slowdowns.

What to know

  • Rustdoc's `build_extern_trait_impls` function was unnecessarily inlining trait documentation from all crate dependencies, causing both stack overflow errors and severe performance degradation.
  • The fix reduced average wall-time by 25% (33% speedup), with real-world improvements up to 40% and microbenchmark improvements reaching 60%.
  • The regression was caught by Crater, Rust's ecosystem-wide testing tool that validates new releases against thousands of public crates before stable release.
  • Lev used profiling tools including `-Z self-profile` and flame graphs to identify the bottleneck and measure the impact of his optimizations.
many voices

The profiling and debugging approach is exemplary and worth learning from.

  • “This is awesome. Curious on the profiling setup there; flame graphs are something I've been after and haven't found a clear way to get them.”

    junon · Lobsters ↗
some voices

Crater's ecosystem-wide testing is a best practice that other projects should adopt.

  • “Great idea. Haven't heard of any other docs engines actively validating new releases against their ecosystem. The status quo is more along the lines of "we have a release candidate, please try it and report bugs."”

    kaycebasques · Lobsters ↗

“So if Rustc was successfully compiling this code, it was concerning that Rustdoc failed on it.”

Noah Lev, Rustdoc team member · noahlev.org blog · Aug 26

Noah Lev Rustdoc team member@theemathas Rust release team member

The record 1 articles and posts · last 30 days

  1. How I made Rustdoc 33% faster in one week post · Hacker News · camelid · 76d ago · 4▲ · 1 comments

What people are saying 12 voices from 1 site · verbatim