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: Improve Bitmap construction performance #15570

Merged
merged 2 commits into from
Apr 10, 2024
Merged

perf: Improve Bitmap construction performance #15570

merged 2 commits into from
Apr 10, 2024

Conversation

ritchie46
Copy link
Member

No description provided.

@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars labels Apr 10, 2024
@@ -90,8 +91,7 @@ where
.zip(a3_chunks)
.map(|((a1, a2), a3)| op(a1, a2, a3));

let buffer = chunk_iter_to_vec(chunks.chain(std::iter::once(op(rem_a1, rem_a2, rem_a3))));
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove chains as they require extra branches on iteration.

2 => combine_validities_and(bitmaps.pop(), bitmaps.pop()),
3 => combine_validities_and3(bitmaps.pop(), bitmaps.pop(), bitmaps.pop()),
_ => {
let mut iterators = bitmaps
Copy link
Member Author

Choose a reason for hiding this comment

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

Single pass/ allocation to combine bitmaps.

@@ -11,10 +11,7 @@ fn fma_arr<T: NumericNative>(
c: &PrimitiveArray<T>,
) -> PrimitiveArray<T> {
assert_eq!(a.len(), b.len());
let validity = combine_validities_and(
Copy link
Member Author

Choose a reason for hiding this comment

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

This could trigger two allocations/passes.

@ritchie46 ritchie46 merged commit a919601 into main Apr 10, 2024
23 checks passed
@ritchie46 ritchie46 deleted the validities branch April 10, 2024 07:43
Copy link

codspeed-hq bot commented Apr 10, 2024

CodSpeed Performance Report

Merging #15570 will not alter performance

Comparing validities (f71a6f5) with main (97c61fe)

Summary

✅ 22 untouched benchmarks

mbuhidar pushed a commit to mbuhidar/polars that referenced this pull request Apr 11, 2024
@c-peters c-peters added the accepted Ready for implementation label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation 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.

2 participants