Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cpp/src/parquet/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1658,13 +1658,19 @@ class DeltaBitPackDecoder : public TypedDecoderImpl<DType> {
values_decode) {
ParquetException::EofException();
}
// Hold the running value and the frame in locals. Both are members of the
// same type as the output, so a store to `buffer` may alias them and the
// compiler must otherwise reload min_delta_ and spill last_value_ on every
// value, which costs two extra memory operations per value.
UT last = static_cast<UT>(last_value_);
const UT min_delta = static_cast<UT>(min_delta_);
for (int j = 0; j < values_decode; ++j) {
// Addition between min_delta, packed int and last_value should be treated as
// unsigned addition. Overflow is as expected.
buffer[i + j] = static_cast<UT>(min_delta_) + static_cast<UT>(buffer[i + j]) +
static_cast<UT>(last_value_);
last_value_ = buffer[i + j];
last += min_delta + static_cast<UT>(buffer[i + j]);
buffer[i + j] = last;
}
last_value_ = static_cast<T>(last);
}
values_remaining_current_mini_block_ -= values_decode;
i += values_decode;
Expand Down
Loading