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

chore(rust): Factor out ensure_is_constant_duration #15733

Merged

Conversation

MarcoGorelli
Copy link
Collaborator

This would enable deduping a few things in https://github.com/pola-rs/polars/pull/12597/files

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars labels Apr 18, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 18, 2024 08:14
Copy link

codspeed-hq bot commented Apr 18, 2024

CodSpeed Performance Report

Merging #15733 will improve performances by 14.83%

Comparing MarcoGorelli:factor-ensure-is-constant-duration-out (55aab11) with main (252e4cf)

Summary

⚡ 1 improvements
✅ 21 untouched benchmarks

Benchmarks breakdown

Benchmark main MarcoGorelli:factor-ensure-is-constant-duration-out Change
test_sort_nan_1942 1,139.6 µs 992.4 µs +14.83%

Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Extracting this logic is a good move if it will be reused 👍 Though I would generally expect that as part of the PR that actually introduces the duplication. After this PR I could look at the code base and think: let's remove this method as it's only used in 1 place. So in this case I would recommend to just include this in the PR you linked.

crates/polars-time/src/windows/duration.rs Outdated Show resolved Hide resolved
crates/polars-time/src/windows/duration.rs Outdated Show resolved Hide resolved
@stinodego stinodego changed the title chore: factor out Duration.ensure_is_constant_duration chore(rust): Factor out Duration.ensure_is_constant_duration Apr 18, 2024
@stinodego stinodego removed the python Related to Python Polars label Apr 18, 2024
@MarcoGorelli
Copy link
Collaborator Author

thanks for your review!

Though I would generally expect that as part of the PR that actually introduces the duplication

That's a fair point - in this case, the discussion in 12597/files has been going on for a while, so I didn't really want to clutter it too much

@stinodego
Copy link
Member

Good to go if CI is green!

@stinodego stinodego changed the title chore(rust): Factor out Duration.ensure_is_constant_duration chore(rust): Factor out ensure_is_constant_duration Apr 18, 2024
@stinodego stinodego merged commit 2e9674e into pola-rs:main Apr 18, 2024
19 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 rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants