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): faster str.contains literal matching in the small-string regime #6811

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Feb 11, 2023

Follow-up (ref: #6777).

The benchmarks are in, and the regex crate is victorious again... Using reg.is_match in all cases gets us equivalent or faster matching vs str::contains for small (<=96 char) strings, and cleaner code. The difference is even more pronounced for larger strings, but we already use the regex crate in that regime, so no changes there...

Benchmark results

str_contains_bench

@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars labels Feb 11, 2023
@alexander-beedie alexander-beedie changed the title perf(python): faster str.contains literal matching in the small-string regime perf(rust): faster str.contains literal matching in the small-string regime Feb 11, 2023
@github-actions github-actions bot added the rust Related to Rust Polars label Feb 11, 2023
@alexander-beedie alexander-beedie removed the python Related to Python Polars label Feb 11, 2023
@ritchie46 ritchie46 merged commit d307963 into pola-rs:master Feb 11, 2023
@alexander-beedie alexander-beedie deleted the string-contains-performance branch February 12, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance issues or improvements rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants