[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API
STINNER Victor
report at bugs.python.org
Wed Oct 13 18:03:50 EDT 2021
STINNER Victor <vstinner at python.org> added the comment:
I measured the stack consumption using attached sys_call.patch and stack_overflow-4.py.
Using gcc -O3, the stack consumption with PR 28893 is *way better* on the 6 benchmarks (6 ways to call functions), especially:
PyObject_CallOneArg(): 624 bytes/call => 528 bytes/call (-96 bytes)
PyObject_CallNoArg(): 608 bytes/call => 512 bytes/call (-96 bytes)
_PyObject_CallNoArg(): 608 bytes/call => 512 bytes/call (-96 bytes)
Python built in release mode with gcc -O3:
./configure && make
=== ref ===
$ ./python stack_overflow-4.py
test_python_call: 10070 calls before crash, stack: 832 bytes/call
test_python_getitem: 16894 calls before crash, stack: 496 bytes/call
test_python_iterator: 12773 calls before crash, stack: 656 bytes/call
test_callonearg: 13428 calls before crash, stack: 624 bytes/call
test_callnoargs: 13779 calls before crash, stack: 608 bytes/call
test_callnoargs_inline: 13782 calls before crash, stack: 608 bytes/call
=> total: 80726 calls, 3824 bytes
=== PR ===
$ ./python stack_overflow-4.py
test_python_call: 11901 calls before crash, stack: 704 bytes/call
test_python_getitem: 18703 calls before crash, stack: 448 bytes/call
test_python_iterator: 14961 calls before crash, stack: 560 bytes/call
test_callonearg: 15868 calls before crash, stack: 528 bytes/call
test_callnoargs: 16366 calls before crash, stack: 512 bytes/call
test_callnoargs_inline: 16365 calls before crash, stack: 512 bytes/call
=> total: 94164 calls, 3264 bytes
----------
Added file: https://bugs.python.org/file50356/stack_overflow-4.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45439>
_______________________________________
More information about the Python-bugs-list
mailing list