A pit full of rusty nails

perf: Improve TokenPair hashing for faster generation #6

merged opened by sachy.dev targeting main from double-hash
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:usjm3ynnir6y4inkcdovrfei/sh.tangled.repo.pull/3mcotipo43t22
+2 -2
Interdiff #1 #2
crates/nailkov/src/distribution.rs

This file has not been changed.

crates/nailkov/src/lib.rs

This file has not been changed.

+2 -2
crates/nailkov/src/token.rs
··· 48 48 #[inline] 49 49 fn hash<H: core::hash::Hasher>(&self, state: &mut H) { 50 50 // Use only with an IdentityHasher so that you don't rehash the hash 51 - self.double_hash().hash(state); 51 + self.mix_hashes().hash(state); 52 52 } 53 53 } 54 54 ··· 62 62 /// Method from [fastbloom](https://github.com/tomtomwombat/fastbloom/blob/main/src/hasher.rs#L190), 63 63 /// which was in turn adapted from <https://www.eecs.harvard.edu/~michaelm/postscripts/rsa2008.pdf>. 64 64 #[inline(always)] 65 - fn double_hash(&self) -> u64 { 65 + fn mix_hashes(&self) -> u64 { 66 66 self.left 67 67 .0 68 68 .digest()

History

3 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
perf: Improve TokenPair hashing for faster generation
expand 0 comments
pull request successfully merged
1 commit
expand
perf: Improve TokenPair hashing for faster generation
2/2 success
expand
expand 0 comments
1 commit
expand
perf: Improve TokenPair hashing for faster generation
2/2 success
expand
expand 0 comments