Repository navigation
Conversation
| .tp_basicsize = sizeof(PyPickleBufferObject), | ||
| .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, | ||
| .tp_new = picklebuf_new, | ||
| .tp_vectorcall = picklebuf_vectorcall, |
There was a problem hiding this comment.
Why add vector all? Is the PickleBuffer used in performance critical code?
There was a problem hiding this comment.
It is listed as speedup candidate in #162350. Benchmark above shows good 1.6x enhancement. This enhancement is free, the only cost to get the benefit is a bit refactor of code to add vectorcall. I think we can do it.
There was a problem hiding this comment.
Makes a measurable difference in pickle benchmarks
There was a problem hiding this comment.
It is not entirely free (it adds code to the binary), but if there are pickle benchmarks that improve it is fine.
Code changes look good to me
There was a problem hiding this comment.
In local prototyping I found overall pickles got measurably faster for small cases. Will re-run with this PR and validate
Replace hand-written
picklebuf_newwith Argument Clinic + vectorcall.Extra positional arguments now raise
TypeError: PickleBuffer expected 1 argument, got Ninstead ofTypeError: PickleBuffer() takes at most 1 argument (N given). Keyword arguments now raiseTypeError: PickleBuffer() takes no keyword argumentsinstead ofTypeError: PickleBuffer() takes exactly 1 positional argument (0 given).Benchmark:
Details