-
Notifications
You must be signed in to change notification settings - Fork 839
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
Faster Parquet Bloom Writer #3333
Conversation
@@ -194,14 +238,14 @@ impl Sbbf { | |||
/// Write the bitset in serialized form to the writer. | |||
fn write_bitset<W: Write>(&self, mut writer: W) -> Result<(), ParquetError> { | |||
for block in &self.0 { |
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 also experimented with transmuting the entire Vec<Block>
this did lead to a very slight additional speed boost of 2%, but I didn't think it justified its unsafe-ness
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.
If it is long slice for all blocks instead of Vec<Block>
? Do you think it would be better?
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 found this only yielded a very slight speed boost of ~2%
for word in block { | ||
writer.write_all(&word.to_le_bytes()).map_err(|e| { | ||
writer | ||
.write_all(block.to_le_bytes().as_slice()) |
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.
Hmm, I think this doesn't write the bytes in same format as before. I guess the reason to write each word in a block sequentially is to follow the spec? The written bloom filter must be sure to be read and understand by other Parquet libraries. Otherwise I have thought to write all words in a bulk like that.
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.
It should write in the same order as the spec? It writes the integers first to last, with each 32-bit integer written little endian?
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, I have thought it wrongly on the order of sequence... 😅
let y = x.wrapping_mul(SALT[i]); | ||
let y = y >> 27; | ||
result[i] = 1 << y; | ||
#[derive(Debug, Copy, Clone)] |
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.
Have we used Copy
and Clone
?
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.
Yes, we use Copy in methods that return Block
Benchmark runs are scheduled for baseline = 31d5706 and contender = 46b2848. 46b2848 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
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?