LANGUAGES Signal 124
Rustdoc filters trait impls before processing, cutting average wall time 25%
Illustration only Photo by Hunter Haley on Unsplash
A Rustdoc team member moved trait impl filtering ahead of the expensive build_impl calls, reducing average wall time by 25% (a 33% speedup) across the benchmark suite.
Rustdoc was processing every trait impl across every dependency and discarding most of them afterward, making doc generation scale with the total impl count in the dependency graph rather than the relevant subset. Reordering the filter means documentation builds for crates with large dependency footprints should feel noticeably faster.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The build_extern_trait_impls pass previously called build_impl on every trait impl in every dependency, then filtered the results afterward.
Adapting the filtering logic to work on raw rustc_middle::ty data structures and running it before build_impl eliminated most redundant processing.
Wall-time reductions reached 40% on crates like hyper and bitmaps and 60% on microbenchmarks like helloworld.
THE CLUSTER