diff options
| author | bors <bors@rust-lang.org> | 2023-03-24 23:41:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-24 23:41:53 +0000 |
| commit | d012d2f96e2959267b14812929b85e17a155f653 (patch) | |
| tree | a123c8a9b399c03551422672c1356346722dc6ec /compiler/rustc_llvm/llvm-wrapper | |
| parent | 8be3c2bda6b683f87b24714ba595e8b04faef54c (diff) | |
| parent | 4d55affc12da448e4a99bf538ccfd66e7ffae5cb (diff) | |
| download | rust-d012d2f96e2959267b14812929b85e17a155f653.tar.gz rust-d012d2f96e2959267b14812929b85e17a155f653.zip | |
Auto merge of #109399 - petrochenkov:rendersort, r=GuillaumeGomez
rustdoc: Optimize impl sorting during rendering
This should fix the perf regression on [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0) from https://github.com/rust-lang/rust/pull/107765.
The bitmaps crate has a lot of impls:
```rust
impl Bits for BitsImpl<1> { ... }
impl Bits for BitsImpl<2> { ... }
// ...
impl Bits for BitsImpl<1023> { ... }
impl Bits for BitsImpl<1024> { ... }
```
and the logic in `fn print_item` sorts them in natural order.
Before https://github.com/rust-lang/rust/pull/107765 the impls came in source order, which happened to be already sorted in the necessary way.
So the comparison function was called fewer times.
After https://github.com/rust-lang/rust/pull/107765 the impls came in "stable" order (based on def path hash).
So the comparison function was called more times to sort them.
The comparison function was terribly inefficient, so it caused a large perf regression.
This PR attempts to make it more efficient by using cached keys during sorting.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
0 files changed, 0 insertions, 0 deletions
