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: Add ArrayChunks to optimize codegen of BatchDecoder #17632

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

coastalwhite
Copy link
Collaborator

@coastalwhite coastalwhite commented Jul 15, 2024

This increases visibility and allows for better control of inlining.

From the first commit we get the following benchmark.

Benchmark 1: After Optimization
  Time (mean ± σ):     18.095 s ±  0.135 s    [User: 10.459 s, System: 7.564 s]
  Range (min … max):   17.976 s … 18.412 s    10 runs

Benchmark 2: Before Optimization
  Time (mean ± σ):     20.863 s ±  0.041 s    [User: 13.129 s, System: 7.648 s]
  Range (min … max):   20.794 s … 20.918 s    10 runs

Summary
  After Optimization ran
    1.15 ± 0.01 times faster than Before Optimization

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars labels Jul 15, 2024
@coastalwhite coastalwhite force-pushed the refactor-parquet-ops branch 2 times, most recently from c1163ae to 082de50 Compare July 15, 2024 11:54
@coastalwhite coastalwhite changed the title refactor: Extract parquet op to trait perf: Extract parquet op to trait Jul 15, 2024
@github-actions github-actions bot added the performance Performance issues or improvements label Jul 15, 2024
@coastalwhite coastalwhite changed the title perf: Extract parquet op to trait perf: ArrayChunks and Mmap in parquet Jul 15, 2024
@coastalwhite coastalwhite changed the title perf: ArrayChunks and Mmap in parquet perf: Add ArrayChunks and Mmap in parquet Jul 15, 2024
@coastalwhite coastalwhite force-pushed the refactor-parquet-ops branch 3 times, most recently from 1a8624b to 17321ee Compare July 15, 2024 13:23
This increases visibility and allows for better control of inlining. We also changed `ChunksExact` to `ArrayChunks`. And this seems to help a lot with the code generation.

As a result, we get the following benchmark:

```
Benchmark 1: After Optimization
  Time (mean ± σ):     18.095 s ±  0.135 s    [User: 10.459 s, System: 7.564 s]
  Range (min … max):   17.976 s … 18.412 s    10 runs

Benchmark 2: Before Optimization
  Time (mean ± σ):     20.863 s ±  0.041 s    [User: 13.129 s, System: 7.648 s]
  Range (min … max):   20.794 s … 20.918 s    10 runs

Summary
  After Optimization ran
    1.15 ± 0.01 times faster than Before Optimization
```
@coastalwhite coastalwhite marked this pull request as ready for review July 15, 2024 13:59
@coastalwhite coastalwhite changed the title perf: Add ArrayChunks and Mmap in parquet perf: Add ArrayChunks to optimize codegen of BatchDecoder Jul 15, 2024
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

Attention: Patch coverage is 82.05128% with 42 lines in your changes missing coverage. Please review.

Project coverage is 80.70%. Comparing base (693181c) to head (457fc94).
Report is 21 commits behind head on main.

Files Patch % Lines
...olars-parquet/src/arrow/read/deserialize/nested.rs 45.83% 13 Missing ⚠️
...olars-parquet/src/arrow/read/deserialize/simple.rs 77.77% 12 Missing ⚠️
...quet/src/arrow/read/deserialize/primitive/basic.rs 91.42% 6 Missing ⚠️
...arquet/src/arrow/read/deserialize/binview/basic.rs 50.00% 4 Missing ⚠️
...parquet/src/arrow/read/deserialize/binary/basic.rs 0.00% 2 Missing ⚠️
...quet/src/arrow/read/deserialize/binary/decoders.rs 33.33% 2 Missing ⚠️
...et/src/arrow/read/deserialize/primitive/integer.rs 90.47% 2 Missing ⚠️
...t/src/arrow/read/deserialize/utils/array_chunks.rs 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17632      +/-   ##
==========================================
+ Coverage   80.65%   80.70%   +0.05%     
==========================================
  Files        1484     1485       +1     
  Lines      195453   195485      +32     
  Branches     2780     2782       +2     
==========================================
+ Hits       157636   157767     +131     
+ Misses      37307    37206     -101     
- Partials      510      512       +2     

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

@ritchie46 ritchie46 merged commit 8bad2fd into pola-rs:main Jul 15, 2024
22 checks passed
@coastalwhite coastalwhite deleted the refactor-parquet-ops branch July 15, 2024 15:15
@c-peters c-peters added the accepted Ready for implementation label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation internal An internal refactor or improvement performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants