]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Sun, 12 Dec 2021 03:50:30 +0000 (03:50 +0000)
committerbors <bors@rust-lang.org>
Sun, 12 Dec 2021 03:50:30 +0000 (03:50 +0000)
commit58457bbfd3b08e015bdb03862a1d3cf2d48a800a
tree88445fa8b6de5be3d113c178fdd0fcecf5a42532
parente70e4d499dd9dd1f7ff3717b9d91ca5dd0757143
parente4b4d18f589b2d0cfcf244124ab43da34a3d8794
Auto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrum

Slightly optimize hash map stable hashing

I was profiling some of the `rustc-perf` benchmarks locally and noticed that quite some time is spent inside the stable hash of hashmaps. I tried to use a `SmallVec` instead of a `Vec` there, which helped very slightly.

Then I tried to remove the sorting, which was a bottleneck, and replaced it with insertion into a binary heap. Locally, it yielded nice improvements in instruction counts and RSS in several benchmarks for incremental builds. The implementation could probably be much nicer and possibly extended to other stable hashes, but first I wanted to test the perf impact properly.

Can I ask someone to do a perf run? Thank you!
compiler/rustc_data_structures/src/stable_hasher.rs