Uh oh!
There was an error while loading. Please reload this page.
bpo-42064: Offset arguments for PyObject_Vectorcall in the _sqlite module - #27931
Conversation
This allows e.g. methods to be called efficiently by providing space for a "self" argument; see PY_VECTORCALL_ARGUMENTS_OFFSET docs.
corona10
commented
Aug 24, 2021
Out of curiosity, How efficient? is there any benchmark? |
encukou
commented
Aug 24, 2021
I'm not aware of one, but the docs say this is encouraged :) |
Uh oh!
There was an error while loading. Please reload this page.
LGTM, thanks for spotting this! This makes sense for the collation callback, but I can't see how the calls in |
| PyObject *inner = PyObject_Vectorcall( | ||
| lru_cache, args + 1, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); |
There was a problem hiding this comment.
Could you please break lines according to PEP 7? I'm striving to keep all sqlite3 changes PEP 7 compliant :)
Ditto for the other calls.
There was a problem hiding this comment.
That is, either:
| PyObject*inner=PyObject_Vectorcall( | |
| lru_cache, args+1, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); | |
| PyObject*inner=PyObject_Vectorcall(lru_cache, args+1, | |
| 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, | |
| NULL); |
or:
| PyObject*inner=PyObject_Vectorcall( | |
| lru_cache, args+1, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); | |
| size_tnargs=1 | PY_VECTORCALL_ARGUMENTS_OFFSET; | |
| PyObject*inner=PyObject_Vectorcall(lru_cache, args+1, nargs, NULL); |
encukou
commented
Aug 31, 2021
Thanks for the reviews! |
This weird mechanism allows e.g. methods to be called efficiently by providing space for a "self" argument; see PY_VECTORCALL_ARGUMENTS_OFFSET docs.
https://bugs.python.org/issue42064