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
ENH: Fix performance issue in keyword extraction #83209
Comments
The keyword argument extraction/finding function seems to have a performance bug/enhancement (unless I am missing something here). It reads:
However, it should be split into two separate for loops, using the I will open a PR for this (it seemed like a bpo number is wanted for almost everything. |
Could you please provide benchmarks which demonstrate the performance issue? |
Fair enough, we had code that does it the other way, so it seemed "too obvious" since the current check seems mainly useful with few kwargs. However, a single kwarg is super common in python, while many seem super rare (in any argument clinic function) Which is why I had even trouble finding a function where it could make a difference, since it needs many kwargs. With changes: sebastian@seberg-x1 ~/python-dev/bin On master: sebastian@seberg-x1 ~/python-dev/bin Which, at close to 5% is barely noticeable, I suppose with more kwargs it could start to make a difference. With less than 3, it just does not matter I guess. Also, I am currently not sure how likely non-interned strings could actually happen. But I am not sure it matters to optimize for them (unless PyArg_From* functions use them). In any case, sorry if this was noise, happy to fix things up or just drop it if many kwargs are considered non-existing. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: