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(python): More efficient handling of *args/**kwargs #7026
Conversation
Wouldn't this add another function call? |
Well, depends on how we approach it. I was thinking of moving When we have it centralized like that, we can make things more verbose to increase performance. For example, we could unpack Because it's a dedicated module, that doesn't harm readability too much as you expect extensive parsing logic there. And it could make all methods that use that parsing logic cleaner and possibly more efficient. I have to admit that up until now I haven't thought too much about this type of optimization, as I believe the power of Polars isn't in the few nanoseconds we can save in dispatching the Python call to Rust, but in the actual computation that happens there. But it's good to keep this in mind more. |
I have been experimenting with applying functools.singledispatch to optimize Maybe this could be combined somehow?
|
@jakob-keller Thanks for the suggestion of using |
Check out #7044 for progress on applying single dispatch to |
Inspired by #7019
Applying the same logic to similar methods.
I will create a centralized parsing module for this, but for now I just added it everywhere as I think it's a good improvement.