gh-100239: specialize bytes binary operations#149458
gh-100239: specialize bytes binary operations#149458Wulian233 wants to merge 2 commits intopython:mainfrom
Conversation
| } | ||
|
|
||
| static PyObject * | ||
| bytes_slice_subscr(PyObject *lhs, PyObject *rhs) |
There was a problem hiding this comment.
The implementation here is seems copied from bytes_subscript (in byteobject.c) and still has a large overlap. Can you refactor the bytes_subscript into multiple methods so that the method here only becomes a very thin wrapper?
corona10
left a comment
There was a problem hiding this comment.
I am not sure we actually need this specialization. Is there any metrics that that this operation is executed frequently in performance benchmark.
We can add tons of specialization it we want, but IIUC, we just pick few of them.
I agree we should limit the number of specializations. The bytes indexing seems worthwhile atm, the bytes slicing not so much. Another option: reconsider an extension mechanism. It was implemented once and reverted (because of a python release date and some technical worries): #133395. If we can get similar performance improvements with the extension mechanism, when we can leave which ops to specialize to the user and outside cpython. |
Documentation build overview
26 files changed ·
|
The following was generated by Codex:
bytes[3]: 20,000,000 iterationsPYTHON_UOPS_OPTIMIZE=0PYTHON_SPECIALIZATION_OFF=1Results:
bytes[3]0.513025s0.701673s~26.9%fasterDetails