]> git.lizzy.rs Git - rust.git/commit - compiler/rustc_parse/src/lexer/unicode_chars.rs
Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obk
authorbors <bors@rust-lang.org>
Sat, 21 Jan 2023 14:18:17 +0000 (14:18 +0000)
committerbors <bors@rust-lang.org>
Sat, 21 Jan 2023 14:18:17 +0000 (14:18 +0000)
commit005fc0f00f2d4ceaf523b67a8f9c5665b8ac5baf
treeaa969088c0dc8aee5e87a1ef814b7a9ba160d832
parent21f683935257713eae8549e8b328367006097053
parentf219771961c94f218d23bfab66aa678c48840fc4
Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obk

Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc)

This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble.

The changes required are moderate but non-zero:
- In some places the collections are extracted into sorted vecs.
- There are a few instances where for-loops have been changed to extends.

~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~

Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)).

Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).

r? `@ghost`
compiler/rustc_hir_analysis/src/variance/solve.rs
compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
compiler/rustc_metadata/src/rmeta/encoder.rs