-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fixed a few errors and sped up estimation by a large factor #15
base: master
Are you sure you want to change the base?
Fixed a few errors and sped up estimation by a large factor #15
Conversation
…d full scan with partition
let sip = &mut self.sip.clone(); | ||
value.hash(sip); | ||
let mut sip = self.sip; | ||
value.hash(&mut sip); | ||
let x = sip.finish(); |
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.
Are you sure this is correct? I'm under the impression that SipHasher13
maintains state that isn't cleared by finish
, meaning that future identical value
's will hash differently.
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 think let mut sip = self.sip; implicitly clones the value.
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.
Ah, right, it implements Copy
.
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.
Yeah, although I think replacing it with a generic that implements the Hasher trait would be cleaner.
Hi @jedisct1 - I was benchmarking this implementation of HyperLogLog alongside a few others, and I noticed a few significant errors that I thought best to fix. Here is what I changed:
-4
there, the precision exponent and the threshold were off.rust-hyperloglog/src/lib.rs
Lines 132 to 134 in bf12a8a
rust-hyperloglog/src/weights.rs
Lines 4291 to 4313 in f190a71
rust-hyperloglog/src/lib.rs
Lines 157 to 181 in f190a71
Other changes are mostly aesthetic to make the code, in my opinion, more readable.
Do note that this pull request needs for the siphash pull request to be merged
Cheers!