-
Notifications
You must be signed in to change notification settings - Fork 868
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
Box RleDecoder index buffer (#1061) #1062
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1062 +/- ##
==========================================
- Coverage 82.31% 82.31% -0.01%
==========================================
Files 168 168
Lines 49056 49056
==========================================
- Hits 40379 40378 -1
- Misses 8677 8678 +1
Continue to review full report at Codecov.
|
@@ -319,7 +319,7 @@ pub struct RleDecoder { | |||
bit_reader: Option<BitReader>, | |||
|
|||
// Buffer used when `bit_reader` is not `None`, for batch reading. | |||
index_buf: [i32; 1024], | |||
index_buf: Option<Box<[i32; 1024]>>, |
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.
While we are at it, could we extract the 1024
to a const
?
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.
Done in #1070
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.
Thanks @tustvold
@@ -440,6 +440,8 @@ impl RleDecoder { | |||
|
|||
let mut values_read = 0; | |||
while values_read < max_values { | |||
let index_buf = self.index_buf.get_or_insert_with(|| Box::new([0; 1024])); |
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.
TIL get_or_insert_with
👍
Merging this in to try and clear the PR backlog -- I implemented @Dandandan 's suggestion in #1070 |
Which issue does this PR close?
Closes #1061.
Rationale for this change
See ticket
What changes are included in this PR?
Changes the
RleDecoder
to box its index buffer, this reduces surprises from a 4KbRleDecoder
struct, and reduces heap allocations ifRleDecoder
is itself heap allocated andRleDecoder::get_batch_with_dict
is never called (e.g. for decoding levels).Running the parquet benchmarks showed no discernible performance impact of this change, as expected
Are there any user-facing changes?
No