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(rust): re-use regex capture allocation (#10302) #10335

Merged
merged 6 commits into from
Aug 7, 2023

Conversation

orlp
Copy link
Collaborator

@orlp orlp commented Aug 7, 2023

Solves #10302.

@orlp orlp requested a review from ritchie46 as a code owner August 7, 2023 12:33
@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature rust Related to Rust Polars labels Aug 7, 2023
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.

Looks great!


// Push nulls if either the string is null or there was no match. We
// distinguish later between the two by copying arr's validity mask.
builders.iter_mut().for_each(|arr| arr.push_null());
Copy link
Member

Choose a reason for hiding this comment

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

Yes, makes sense. The copy doesn't add much today, but will be correct once we added a validity to polars' struct type.

@@ -15,11 +13,6 @@ use super::*;
#[cfg(feature = "binary_encoding")]
use crate::chunked_array::binary::BinaryNameSpaceImpl;

fn f_regex_extract<'a>(reg: &Regex, input: &'a str, group_index: usize) -> Option<Cow<'a, str>> {
Copy link
Member

Choose a reason for hiding this comment

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

Yes, nice cleanup. Better to have the implementation separated from the dispatch. 👍

@ritchie46 ritchie46 changed the title feat(rust): re-use regex capture allocation (#10302) perf(rust): re-use regex capture allocation (#10302) Aug 7, 2023
@github-actions github-actions bot added the performance Performance issues or improvements label Aug 7, 2023
@ritchie46 ritchie46 merged commit 373b2c7 into pola-rs:main Aug 7, 2023
17 checks passed
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 rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants