-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
rustc uses FxHash{Set,Map} everywhere rather than Hash{Set,Map}, because the DefaultHasher used by Hash{Set,Map} is slow.
But once #69152 lands, DefaultHasher will 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 that FxHasher is 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 that HashSet<u32> was a little bit faster than FxHashSet<u32>.)
We should evaluate this, probably by replacing every FxHash{Set,Map} with Hash{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