bpo-43706: Use PEP 590 vectorcall to speed up enumerate() #25154
Conversation
I'm not against such micro-optimization, but I'm not convinced that it's worth it compared to the size of the code to parse arguments: enum_vectorcall() code. If bpo-43447 is implemented, I would be more comfortable to accept such micro-optimization. Right now, it adds many lines of code that should be maintained manually.
The micro-benchmark is measure the creation of the enumerate object, it does not iterate it. I expect for that long sequence, the benefit is not significant. But for short sequence, it is more likely interesting.
@@ -80,6 +80,45 @@ enum_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start) | |||
return (PyObject *)en; | |||
} | |||
|
|||
// TODO: Use AC when bpo-43447 is supported |
I would prefer to track these tasks in the bpo rather than directly in the Python source code.
This is expected worry when I try to implement this. I also agree with you. |
This PR is stale because it has been open for 30 days with no activity. |
Can you please re-run you benchmark? Maybe Python performance changed in the meanwhile. |
Same effect.
|
LGTM.
bench enumerate | 533 ns | 341 ns: 1.56x faster
is worth it.
https://bugs.python.org/issue43706
The text was updated successfully, but these errors were encountered: