Skip to content
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 DeltaBitPackDecoder #1281

Closed
tustvold opened this issue Feb 7, 2022 · 1 comment · Fixed by #1284
Closed

Speed up DeltaBitPackDecoder #1281

tustvold opened this issue Feb 7, 2022 · 1 comment · Fixed by #1284
Labels
enhancement Any new improvement worthy of a entry in the changelog parquet Changes to the parquet crate performance

Comments

@tustvold
Copy link
Contributor

tustvold commented Feb 7, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

The current DeltaBitPackDecoder implementation decodes each value separately with a call to BitReader::get_unaligned. This prevents it from benefiting from the vectorized unpack32 that is used by RLEDecoder, and makes for a complex inner body of the loop. It also seems to do a fair amount of memory allocation on the hot path, which is also unfortunate.

Describe the solution you'd like

The DeltaBitPackDecoder should be faster than RLEDecoder and theoretically should be even faster than PlainDecoder - the algorithm is specifically designed to vectorize well. Most of the logic to achieve this already exists, it is just a matter of hooking it up.

One small detail is unpack32 can only handle a bit width less than 32. This should be a rare degenerate case, as the format stores deltas not values, but the logic will need to fallback in such a case

@tustvold tustvold added the enhancement Any new improvement worthy of a entry in the changelog label Feb 7, 2022
@tustvold
Copy link
Contributor Author

tustvold commented Feb 7, 2022

I have a PR of this mostly done, just hunting down remaining bugs

tustvold added a commit to tustvold/arrow-rs that referenced this issue Feb 7, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Feb 8, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Feb 8, 2022
alamb pushed a commit that referenced this issue Feb 15, 2022
* Vectorized `DeltaBitPackDecoder` (#1281)

* Review feedback
@alamb alamb added parquet Changes to the parquet crate performance labels Feb 16, 2022
@alamb alamb changed the title Faster DeltaBitPackDecoder Speed up DeltaBitPackDecoder Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog parquet Changes to the parquet crate performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants