Skip to content
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

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Feb 9, 2025

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.

Copy link

netlify bot commented Feb 9, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit e725854
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67a869c891eab500088c1c37

Copy link

codspeed-hq bot commented Feb 9, 2025

CodSpeed Performance Report

Merging #682 will not alter performance

Comparing Veykril:veykril/push-vntqlkpyzmqm (e725854) with master (54a1740)

Summary

✅ 9 untouched benchmarks

@Veykril Veykril force-pushed the veykril/push-vntqlkpyzmqm branch 3 times, most recently from 3179952 to e677179 Compare February 9, 2025 07:24
Copy link
Contributor

@MichaReiser MichaReiser left a 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() {
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 2 unit tests

@Veykril Veykril force-pushed the veykril/push-vntqlkpyzmqm branch from e677179 to 547acab Compare February 9, 2025 08:37
@Veykril
Copy link
Member Author

Veykril commented Feb 9, 2025

Thanks. Hashbrowns raw entry api is somewhat easy to hold wrong and the documentation is very sparse.

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

@Veykril Veykril force-pushed the veykril/push-vntqlkpyzmqm branch from 547acab to e725854 Compare February 9, 2025 08:39
Copy link
Contributor

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@MichaReiser MichaReiser added this pull request to the merge queue Feb 9, 2025
Merged via the queue into salsa-rs:master with commit 538eaad Feb 9, 2025
10 checks passed
@Veykril Veykril deleted the veykril/push-vntqlkpyzmqm branch February 9, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants