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: Cache register plugin function #18860

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Sep 23, 2024

closes #18857

Can confirm that this resolves the issue

before:

Screenshot 2024-09-23 131317

after:

Screenshot 2024-09-23 131237

@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars labels Sep 23, 2024
@@ -111,6 +112,7 @@ def _serialize_kwargs(kwargs: dict[str, Any] | None) -> bytes:
return pickle.dumps(kwargs, protocol=5)


@lru_cache(maxsize=16)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a large number of pathlib objects can be heavy to cache: psf/black#1950. so i think it's good to set a maxsize

I think it's very unlikely that anyone would be using more than 16 plugins in the same project anyway..

Copy link
Member

Choose a reason for hiding this comment

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

Not in a hot loop at least.

Copy link
Contributor

Choose a reason for hiding this comment

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

a large number of pathlib objects can be heavy to cache: psf/black#1950. so i think it's good to set a maxsize

I think it's very unlikely that anyone would be using more than 16 plugins in the same project anyway..

Does 16 mean 16 different plugin functions or 16 distinct plugins?

Copy link
Contributor

Choose a reason for hiding this comment

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

NVM, should be 16 plugin packages..

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.88%. Comparing base (262f7bc) to head (39df0ee).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18860   +/-   ##
=======================================
  Coverage   79.87%   79.88%           
=======================================
  Files        1519     1519           
  Lines      205839   205841    +2     
  Branches     2898     2899    +1     
=======================================
+ Hits       164416   164438   +22     
+ Misses      40875    40855   -20     
  Partials      548      548           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 48c1262 into pola-rs:main Sep 23, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance of register_plugin_function
3 participants