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

refactor: improve rank implementation, especially around nulls #11651

Merged
merged 4 commits into from
Oct 11, 2023

Conversation

orlp
Copy link
Collaborator

@orlp orlp commented Oct 10, 2023

Fixes #11252.

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars labels Oct 10, 2023
@@ -42,8 +43,29 @@ fn get_random_seed() -> u64 {
rng.next_u64()
}

unsafe fn rank_impl<F: FnMut(&mut [IdxSize])>(idxs: &IdxCa, neq: &BooleanArray, mut flush_ties: F) {
let mut ties_indices = Vec::with_capacity(128);
let mut idx_it = idxs.downcast_iter().flat_map(|arr| arr.values_iter());
Copy link
Member

Choose a reason for hiding this comment

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

Can we use a double loop here, so the iteration is slightly faster?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this compiles down to a double loop.

@ritchie46 ritchie46 merged commit 104ee93 into pola-rs:main Oct 11, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.rank() panics when pl.Utf8 series contains null
2 participants