Repository navigation
Use FxHash for the type checker's internal maps and sets - #295
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The type checker's comparison, intersection, substitution and memoization keep their maps and sets keyed by small integer IDs, and hashing those with SipHash was a large part of their run time. This switches them to FxHash (
rustc-hash2).Changes
rue-types/src/hash.rs, which re-exportsFxHashMapandFxHashSetand defines theFxIndexMapandFxIndexSetaliases.memo.rs,compare.rs(theComparisonContextstack, bindings, references, rigid and monotone sets),intersect.rs,substitute.rs(the stack, memo and renames) andcheck.rs(the check memo and the overlap stack) use them.HashMap<TypeId, TypeId>taken by the publicsubstitute_with_mappingsis left as it is.Timings
These are debug builds, compared against
65b2f24d:test_memo_differentialtest_check_propertytest_check_property_genericsTogether with #294, the CPU time of the
rue-testssnapshot suite went from 37.2s to 24.8s.The ignored
test_memo_differential_largestill passes, taking about 5.5 min in release.