bpo-45636: Simpler design for BINARY_OP/INPLACE_OP#29418
bpo-45636: Simpler design for BINARY_OP/INPLACE_OP#29418brandtbucher wants to merge 11 commits intopython:mainfrom
BINARY_OP/INPLACE_OP#29418Conversation
|
Currently re-running benchmarks, for my own sanity… |
|
I'm glad I did. It seems that that single change contributes to the slowdown we saw on the other PR: DetailsIt's not clear to me why. Perhaps |
|
@brandtbucher Maybe the change created a branching point with random targets, so CPU branch predictor just gives up with prefetching. A profiler will help to find exact lines with the longest execution time. |
markshannon
left a comment
There was a problem hiding this comment.
I suspect the awkward size of nb_name_info may be responsible for most of the slowdown.
| #undef NB_NAME_INFO | ||
|
|
||
| PyObject * | ||
| _PyNumber_Op(PyObject *o1, PyObject *o2, unsigned op) |
There was a problem hiding this comment.
This just forwards to binary_op. You might want to consider:
- Make this the function that does the work (effectively inlining
binary_ophere). - Make the old API
PyNumber_TrueDivide, etc. call_PyNumber_Op - Delete
binary_op.
| } | ||
|
|
||
| PyObject * | ||
| _PyNumber_InPlaceOp(PyObject *o1, PyObject *o2, unsigned op) |
There was a problem hiding this comment.
Same comment as for _PyNumber_Op.
|
When you're done making the requested changes, leave the comment: |
|
See my new (preferred) approach in #29482. |
|
You were right @markshannon: adjusting the alignment fixes the slowdown. Nice catch. Details |
|
Closing in favor of #29482. |
No perf impact:
Details
https://bugs.python.org/issue45636