Skip to content

[Perf Experiment] Change FxHash to GxHash #127040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixup things for perf run
Remove build script
  • Loading branch information
blyxyas committed Jun 27, 2024
commit 4ada799d108eeffd9f70c927f387d44845a10b59
23 changes: 15 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ dependencies = [
"fluent-syntax",
"intl-memoizer",
"intl_pluralrules",
"rustc-hash",
"rustc-hash 1.1.0",
"self_cell 0.10.3",
"smallvec",
"unic-langid",
Expand Down Expand Up @@ -2083,7 +2083,7 @@ dependencies = [
"anyhow",
"clap",
"fs-err",
"rustc-hash",
"rustc-hash 1.1.0",
"rustdoc-json-types",
"serde",
"serde_json",
Expand Down Expand Up @@ -2415,7 +2415,7 @@ dependencies = [
"memmap2",
"parking_lot",
"perf-event-open-sys",
"rustc-hash",
"rustc-hash 1.1.0",
"smallvec",
]

Expand Down Expand Up @@ -3025,7 +3025,7 @@ checksum = "c4e8e505342045d397d0b6674dcb82d6faf5cf40484d30eeb88fc82ef14e903f"
dependencies = [
"datafrog",
"log",
"rustc-hash",
"rustc-hash 1.1.0",
]

[[package]]
Expand Down Expand Up @@ -3457,6 +3457,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"

[[package]]
name = "rustc-hash"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"

[[package]]
name = "rustc-main"
version = "0.0.0"
Expand Down Expand Up @@ -3834,6 +3840,7 @@ dependencies = [
"memmap2",
"parking_lot",
"portable-atomic",
"rustc-hash 2.0.0",
"rustc-rayon",
"rustc_arena",
"rustc_graphviz",
Expand Down Expand Up @@ -4521,7 +4528,7 @@ dependencies = [
name = "rustc_pattern_analysis"
version = "0.0.0"
dependencies = [
"rustc-hash",
"rustc-hash 1.1.0",
"rustc_apfloat",
"rustc_arena",
"rustc_data_structures",
Expand Down Expand Up @@ -4913,7 +4920,7 @@ name = "rustdoc-json-types"
version = "0.1.0"
dependencies = [
"bincode",
"rustc-hash",
"rustc-hash 1.1.0",
"serde",
"serde_json",
]
Expand Down Expand Up @@ -5641,7 +5648,7 @@ dependencies = [
"ignore",
"miropt-test-tools",
"regex",
"rustc-hash",
"rustc-hash 1.1.0",
"semver",
"similar",
"termcolor",
Expand Down Expand Up @@ -5895,7 +5902,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f"
dependencies = [
"rustc-hash",
"rustc-hash 1.1.0",
]

[[package]]
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ bitflags = "2.4.1"
either = "1.0"
elsa = "=1.7.1"
ena = "0.14.3"
gxhash = "3.4.1"
indexmap = { version = "2.0.0" }
jobserver_crate = { version = "0.1.28", package = "jobserver" }
measureme = "11"
Expand Down Expand Up @@ -53,6 +52,12 @@ memmap2 = "0.2.1"
[target.'cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))'.dependencies]
portable-atomic = "1.5.1"

[target.'cfg(not(all(target_feature = "sse2", target_feature = "aes")))'.dependencies]
rustc-hash = "2.0.0"

[target.'cfg(all(target_feature = "sse2", target_feature = "aes"))'.dependencies]
gxhash = "3.4.1"

[features]
# tidy-alphabetical-start
rustc_use_parallel_compiler = ["indexmap/rustc-rayon", "rustc-rayon"]
Expand Down
15 changes: 8 additions & 7 deletions compiler/rustc_data_structures/src/gx.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use std::{
collections::{HashMap, HashSet},
hash::BuildHasherDefault,
};
use std::hash::BuildHasherDefault;

// pub use rustc_hash::{GxHashMap, GxHashSet, GxHasher};
#[cfg(not(all(target_feature = "sse2", target_feature = "aes")))]
pub use rustc_hash::{FxHashMap as GxHashMap, FxHashSet as GxHashSet, FxHasher as GxHasher};

#[cfg(all(target_feature = "sse2", target_feature = "aes"))]
pub use gxhash::GxHasher;

pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>;

pub type GxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<GxHasher>>;
pub type GxHashSet<T> = HashSet<T, BuildHasherDefault<GxHasher>>;
#[cfg(all(target_feature = "sse2", target_feature = "aes"))]
pub type GxHashMap<K, V> = std::collections::HashMap<K, V, BuildHasherDefault<GxHasher>>;
#[cfg(all(target_feature = "sse2", target_feature = "aes"))]
pub type GxHashSet<T> = std::collections::HashSet<T, BuildHasherDefault<GxHasher>>;

pub type GxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<GxHasher>>;
pub type GxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<GxHasher>>;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2907,7 +2907,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty::Adt(def, _) => Some(def.did()),
_ => None,
})
.collect::<FxIndexSet<_>>();
.collect::<GxIndexSet<_>>();
let mut foreign_spans: MultiSpan = foreign_def_ids
.iter()
.filter_map(|def_id| {
Expand Down
22 changes: 11 additions & 11 deletions tests/ui/generic-associated-types/self-outlives-lint.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@ LL | type Bar<'b>;
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information

error: missing required bound on `Iterator`
--> $DIR/self-outlives-lint.rs:142:5
|
LL | type Iterator<'a>: Iterator<Item = Self::Item<'a>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: add the required where clause: `where Self: 'a`
|
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information

error: missing required bound on `Item`
--> $DIR/self-outlives-lint.rs:140:5
|
Expand All @@ -130,6 +119,17 @@ LL | type Item<'a>;
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information

error: missing required bound on `Iterator`
--> $DIR/self-outlives-lint.rs:142:5
|
LL | type Iterator<'a>: Iterator<Item = Self::Item<'a>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
| help: add the required where clause: `where Self: 'a`
|
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information

error: missing required bound on `Item`
--> $DIR/self-outlives-lint.rs:148:5
|
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/lint/unused/unused-macro-rules-compile-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ note: the lint level is defined here
LL | #![deny(unused_macro_rules)]
| ^^^^^^^^^^^^^^^^^^

error: rule #3 of macro `num2` is never used
--> $DIR/unused-macro-rules-compile-error.rs:22:5
|
LL | (two_) => { compile_error! };
| ^^^^^^

error: rule #2 of macro `num2` is never used
--> $DIR/unused-macro-rules-compile-error.rs:20:5
|
LL | (two) => { fn compile_error() {} };
| ^^^^^

error: rule #3 of macro `num2` is never used
--> $DIR/unused-macro-rules-compile-error.rs:22:5
|
LL | (two_) => { compile_error! };
| ^^^^^^

error: aborting due to 3 previous errors

16 changes: 8 additions & 8 deletions tests/ui/lint/unused/unused-macro-rules-decl.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: rule #4 of macro `num` is never used
--> $DIR/unused-macro-rules-decl.rs:11:5
error: rule #2 of macro `num` is never used
--> $DIR/unused-macro-rules-decl.rs:9:5
|
LL | (four) => { 4 },
| ^^^^^^
LL | (two) => { 2 },
| ^^^^^
|
note: the lint level is defined here
--> $DIR/unused-macro-rules-decl.rs:2:9
|
LL | #![deny(unused_macro_rules)]
| ^^^^^^^^^^^^^^^^^^

error: rule #2 of macro `num` is never used
--> $DIR/unused-macro-rules-decl.rs:9:5
error: rule #4 of macro `num` is never used
--> $DIR/unused-macro-rules-decl.rs:11:5
|
LL | (two) => { 2 },
| ^^^^^
LL | (four) => { 4 },
| ^^^^^^

error: rule #3 of macro `num_rec` is never used
--> $DIR/unused-macro-rules-decl.rs:31:5
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/lint/unused/unused-macro-rules.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: rule #4 of macro `num` is never used
--> $DIR/unused-macro-rules.rs:10:5
error: rule #2 of macro `num` is never used
--> $DIR/unused-macro-rules.rs:8:5
|
LL | (four) => { 4 };
| ^^^^^^
LL | (two) => { 2 };
| ^^^^^
|
note: the lint level is defined here
--> $DIR/unused-macro-rules.rs:1:9
|
LL | #![deny(unused_macro_rules)]
| ^^^^^^^^^^^^^^^^^^

error: rule #2 of macro `num` is never used
--> $DIR/unused-macro-rules.rs:8:5
error: rule #4 of macro `num` is never used
--> $DIR/unused-macro-rules.rs:10:5
|
LL | (two) => { 2 };
| ^^^^^
LL | (four) => { 4 };
| ^^^^^^

error: rule #3 of macro `num_rec` is never used
--> $DIR/unused-macro-rules.rs:30:5
Expand Down
37 changes: 22 additions & 15 deletions tests/ui/stats/hir-stats.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ ast-stats-1 ExprField 48 ( 0.7%) 1 48
ast-stats-1 WherePredicate 56 ( 0.8%) 1 56
ast-stats-1 - BoundPredicate 56 ( 0.8%) 1
ast-stats-1 Attribute 64 ( 1.0%) 2 32
ast-stats-1 - Normal 32 ( 0.5%) 1
ast-stats-1 - DocComment 32 ( 0.5%) 1
ast-stats-1 - Normal 32 ( 0.5%) 1
ast-stats-1 Local 80 ( 1.2%) 1 80
ast-stats-1 ForeignItem 88 ( 1.3%) 1 88
ast-stats-1 - Fn 88 ( 1.3%) 1
ast-stats-1 Arm 96 ( 1.4%) 2 48
ast-stats-1 FnDecl 120 ( 1.8%) 5 24
ast-stats-1 Param 160 ( 2.4%) 4 40
ast-stats-1 FieldDef 160 ( 2.4%) 2 80
ast-stats-1 Stmt 160 ( 2.4%) 5 32
ast-stats-1 - Let 32 ( 0.5%) 1
Expand All @@ -41,9 +42,15 @@ ast-stats-1 - Lit 144 ( 2.2%) 2
ast-stats-1 - Block 216 ( 3.3%) 3
ast-stats-1 PathSegment 744 (11.2%) 31 24
ast-stats-1 Ty 896 (13.5%) 14 64
ast-stats-1 - Ptr 64 ( 1.0%) 1
ast-stats-1 - Ref 64 ( 1.0%) 1
ast-stats-1 - Ptr 64 ( 1.0%) 1
ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2
ast-stats-1 - Path 640 ( 9.7%) 10
ast-stats-1 Item 1_224 (18.5%) 9 136
ast-stats-1 - ForeignMod 136 ( 2.1%) 1
ast-stats-1 - Trait 136 ( 2.1%) 1
ast-stats-1 - Impl 136 ( 2.1%) 1
ast-stats-1 - Enum 136 ( 2.1%) 1
ast-stats-1 - Path 640 ( 9.6%) 10
ast-stats-1 Item 1_224 (18.4%) 9 136
ast-stats-1 - Trait 136 ( 2.0%) 1
Expand Down Expand Up @@ -73,6 +80,7 @@ ast-stats-2 FnDecl 120 ( 1.6%) 5 24
ast-stats-2 Attribute 128 ( 1.8%) 4 32
ast-stats-2 - DocComment 32 ( 0.4%) 1
ast-stats-2 - Normal 96 ( 1.3%) 3
ast-stats-2 Param 160 ( 2.2%) 4 40
ast-stats-2 FieldDef 160 ( 2.2%) 2 80
ast-stats-2 Stmt 160 ( 2.2%) 5 32
ast-stats-2 - Let 32 ( 0.4%) 1
Expand Down Expand Up @@ -101,12 +109,11 @@ ast-stats-2 - Block 216 ( 3.0%) 3
ast-stats-2 PathSegment 864 (11.9%) 36 24
ast-stats-2 Ty 896 (12.3%) 14 64
ast-stats-2 - Ptr 64 ( 0.9%) 1
ast-stats-2 - Ref 64 ( 0.9%) 1
ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2
ast-stats-2 - Path 640 ( 8.8%) 10
ast-stats-2 Item 1_496 (20.5%) 11 136
ast-stats-2 - Trait 136 ( 1.9%) 1
ast-stats-2 - Enum 136 ( 1.9%) 1
ast-stats-2 - Impl 136 ( 1.9%) 1
ast-stats-2 - ExternCrate 136 ( 1.9%) 1
ast-stats-2 - ForeignMod 136 ( 1.9%) 1
ast-stats-2 - Impl 136 ( 1.9%) 1
Expand All @@ -125,9 +132,9 @@ hir-stats ExprField 40 ( 0.4%) 1 40
hir-stats TraitItemRef 56 ( 0.6%) 2 28
hir-stats Local 64 ( 0.7%) 1 64
hir-stats Param 64 ( 0.7%) 2 32
hir-stats Body 72 ( 0.8%) 3 24
hir-stats InlineAsm 72 ( 0.8%) 1 72
hir-stats ImplItemRef 72 ( 0.8%) 2 36
hir-stats InlineAsm 72 ( 0.8%) 1 72
hir-stats Body 72 ( 0.8%) 3 24
hir-stats Arm 80 ( 0.9%) 2 40
hir-stats GenericArg 96 ( 1.1%) 4 24
hir-stats - Type 24 ( 0.3%) 1
Expand All @@ -139,36 +146,36 @@ hir-stats - Semi 32 ( 0.4%) 1
hir-stats - Expr 32 ( 0.4%) 1
hir-stats FnDecl 120 ( 1.3%) 3 40
hir-stats Attribute 128 ( 1.4%) 4 32
hir-stats Variant 144 ( 1.6%) 2 72
hir-stats GenericArgs 144 ( 1.6%) 3 48
hir-stats GenericBound 192 ( 2.1%) 4 48
hir-stats - Trait 192 ( 2.1%) 4
hir-stats Variant 144 ( 1.6%) 2 72
hir-stats WherePredicate 192 ( 2.1%) 3 64
hir-stats - BoundPredicate 192 ( 2.1%) 3
hir-stats GenericBound 192 ( 2.1%) 4 48
hir-stats - Trait 192 ( 2.1%) 4
hir-stats Block 288 ( 3.2%) 6 48
hir-stats GenericParam 360 ( 4.0%) 5 72
hir-stats Pat 360 ( 4.0%) 5 72
hir-stats - Wild 72 ( 0.8%) 1
hir-stats - Struct 72 ( 0.8%) 1
hir-stats - Wild 72 ( 0.8%) 1
hir-stats - Binding 216 ( 2.4%) 3
hir-stats GenericParam 360 ( 4.0%) 5 72
hir-stats Generics 560 ( 6.2%) 10 56
hir-stats Ty 720 ( 8.0%) 15 48
hir-stats - Ptr 48 ( 0.5%) 1
hir-stats - Ref 48 ( 0.5%) 1
hir-stats - Ptr 48 ( 0.5%) 1
hir-stats - Path 624 ( 6.9%) 13
hir-stats Expr 768 ( 8.5%) 12 64
hir-stats - Path 64 ( 0.7%) 1
hir-stats - Struct 64 ( 0.7%) 1
hir-stats - Match 64 ( 0.7%) 1
hir-stats - Struct 64 ( 0.7%) 1
hir-stats - InlineAsm 64 ( 0.7%) 1
hir-stats - Lit 128 ( 1.4%) 2
hir-stats - Block 384 ( 4.3%) 6
hir-stats Item 968 (10.8%) 11 88
hir-stats - Trait 88 ( 1.0%) 1
hir-stats - Enum 88 ( 1.0%) 1
hir-stats - Trait 88 ( 1.0%) 1
hir-stats - Impl 88 ( 1.0%) 1
hir-stats - ExternCrate 88 ( 1.0%) 1
hir-stats - ForeignMod 88 ( 1.0%) 1
hir-stats - Impl 88 ( 1.0%) 1
hir-stats - Fn 176 ( 2.0%) 2
hir-stats - Use 352 ( 3.9%) 4
hir-stats Path 1_240 (13.8%) 31 40
Expand Down
Loading