-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Re-evaluate Hash{Set,Map} vs FxHash{Set,Map} once #69152 lands #69153
Copy link
Copy link
Closed
Labels
I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler PerformanceWorking group: Compiler Performance
Metadata
Metadata
Assignees
Labels
I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler PerformanceWorking group: Compiler Performance
Type
Fields
Give feedbackNo fields configured for issues without a type.
rustc uses
FxHash{Set,Map}everywhere rather thanHash{Set,Map}, because theDefaultHasherused byHash{Set,Map}is slow.But once #69152 lands,
DefaultHasherwill be a lot faster when hashing integers, which is a common case; in one microbenchmark I saw a ~2.5x speed-up. Combine that with the fact thatFxHasheris a lower-quality hasher and so tends to result in more collisions, and the default hash tables might be faster. (On a different microbenchmark I saw thatHashSet<u32>was a little bit faster thanFxHashSet<u32>.)We should evaluate this, probably by replacing every
FxHash{Set,Map}withHash{Set,Map}. (It keeps things simpler if we exclusively used one or the other, rather than a mix.)I briefly tried to do this, but we have a lint that produces this message if you try to use
Hash{Set,Map}: "error: Prefer FxHashSet over HashSet, it has better performance". I couldn't work out how to disable it.cc @rust-lang/wg-compiler-performance
cc @cbreeden
cc @Amanieu