-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix Disambiguator- and IdentityMap hashing #682
Conversation
✅ Deploy Preview for salsa-rs canceled.
|
CodSpeed Performance ReportMerging #682 will not alter performanceComparing Summary
|
3179952
to
e677179
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Hashbrowns raw entry api is somewhat easy to hold wrong and the documentation is very sparse.
.collect(), | ||
); | ||
let trackeds = batch(&db, inputs); | ||
for (id, tracked) in trackeds.into_iter().enumerate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this test exercises the right code path. We need at lesst two revisions, were both construct roughly the same tracked stucts because the identity map isn't used in a single revision (and we then just end up disambiguating too often)
It might be easier to write a unit test for each map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of writing a unit test, but then we'd still not actually test that disambiguating works as expected (as no test actual hits the disambiguator). I guess the test here + a unit test should cover things though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 2 unit tests
e677179
to
547acab
Compare
It is rather sparse but this was entirely my mistake, the hash is part of the identity/eq of our struct here so it doesn't make sense to leave it out when comparing |
547acab
to
e725854
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
As was raised by @ibraheemdev in #647, the hashmap may consider slots/buckets that do not uniquely correspond to a single hash so the hash itself is required for equality in our case.
Added a test that exerts the disambiguator mapping as we have no test that actually hits it, though even without the changes here that test won't fail. I am not quite sure what a setup for that would be.