-
Notifications
You must be signed in to change notification settings - Fork 679
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
Speed up writing bloom filter #3325
Conversation
|
ea7a36a
to
7360f89
Compare
)) | ||
})?; | ||
let pointer: *const u8 = (word as *const u32) as *const _; | ||
let bytes: &[u8] = |
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.
NGL it is kind of disappointing that LLVM isn't able to automatically make this optimization, I will have a play and see if I can get it to do the correct thing
let bytes: &[u8] = | ||
unsafe { slice::from_raw_parts(pointer, mem::size_of::<u32>()) }; | ||
if cfg!(target_endian = "big") { | ||
Self::write_all_for_big_endian(&mut writer, bytes)?; |
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.
Could we just use word.to_le_bytes()
here, I imagine it will be faster than the code below and is certainly less code
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.
okay
This nerd-sniped me to the point where I created #3333, which at least in my testing performs better than this PR, PTAL 😄 |
Which issue does this PR close?
Part of #3320.
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?