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

uses ahash::RandomState::hash_one in deduper::Deduper #4184

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

behzadnouri
Copy link

Problem

ahash::RandomState has specializations for hashing single value, which can be faster for primitive types:
https://github.com/tkaitchuck/aHash/blob/7d5c661a7/src/random_state.rs#L317
https://github.com/tkaitchuck/aHash/blob/7d5c661a7/src/specialize.rs#L17-L19

Summary of Changes

The commit uses ahash::RandomState::hash_one in deduper::Deduper.

Copy link

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

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

lgtm! only concern i had initially was hashing: &(key, i) here:

(0..max_duplicate_count).all(|i| self.shred_id_filter.dedup(&(key, i)))

but if i'm reading this right, key is of type ShredId and ShredId is just three primitive types under the hood. so should be good!

@behzadnouri behzadnouri merged commit a02fe7a into anza-xyz:master Jan 3, 2025
40 checks passed
@behzadnouri behzadnouri deleted the deduper-hash-one branch January 3, 2025 23:34
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