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

perf: Faster bitpacking for Parquet writer #16278

Merged
merged 10 commits into from
May 18, 2024

Conversation

thalassemia
Copy link
Contributor

@thalassemia thalassemia commented May 16, 2024

I replaced the Parquet bit-packing algorithm with a modified version of the scalar algorithm from https://github.com/quickwit-oss/bitpacking (unsure where/how to give credit). I ensured the new algorithm works by adding unit tests that encode/decode random data.

I added a microbenchmark in my first commit to help measure the performance gain.

Before After
Avg. (ns/iter) 93.75 4.25
Std. (ns/iter) 1.57 0.04

I removed the microbenchmark in a later commit because it requires nightly Rust and is probably not useful outside of this PR.

Other miscellaneous fixes:

  • Packed array of 64 u64's should have a maximum length of 64 * 8 u8's (second commit)
  • Input array length should be compared to expected unpacked length instead of expected packed length to avoid unnecessary allocations/copies (third commit)

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels May 16, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.34%. Comparing base (11fe9d8) to head (b8ff88d).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16278      +/-   ##
==========================================
+ Coverage   80.80%   81.34%   +0.53%     
==========================================
  Files        1393     1403      +10     
  Lines      179406   183257    +3851     
  Branches     2921     2922       +1     
==========================================
+ Hits       144971   149063    +4092     
+ Misses      33932    33691     -241     
  Partials      503      503              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 changed the title feat(rust,python): Faster bitpacking for Parquet writer perf: Faster bitpacking for Parquet writer May 17, 2024
@github-actions github-actions bot added the performance Performance issues or improvements label May 17, 2024
Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement! 👏

I replaced the Parquet bit-packing algorithm with a modified version of the scalar algorithm from https://github.com/quickwit-oss/bitpacking (unsure where/how to give credit)

Can you a comment saying that you adapted from .

crates/polars-parquet/Cargo.toml Outdated Show resolved Hide resolved
@ritchie46
Copy link
Member

Nice improvement! Thanks a lot @thalassemia. 🙌 Hope you find some on the reading side as well. ;)

@ritchie46 ritchie46 merged commit 27de0d8 into pola-rs:main May 18, 2024
21 checks passed
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants