STINNER Victor added the comment: Full commit message: --- Disable _PyStack_AsTuple() inlining
Issue #29234: Inlining _PyStack_AsTuple() into callers increases their stack consumption, Disable inlining to optimize the stack consumption. Add _Py_NO_INLINE: use __attribute__((noinline)) of GCC and Clang. It reduces the stack consumption, bytes per call, before => after: test_python_call: 1040 => 976 (-64 B) test_python_getitem: 976 => 912 (-64 B) test_python_iterator: 1120 => 1056 (-64 B) => total: 3136 => 2944 (- 192 B) --- Serhiy Storchaka: "What is a stack usage effect of disabling inlining _PyStack_AsTuple()?" The total effect on the 3 tests is to reduce the stack consumption by 192 bytes/call, or 64 bytes/call (8 CPU words) for each test. > Does it impact performance? I ran a benchmark on 3 changes at once. The effect is a speedup, not a slowdown: http://bugs.python.org/issue28870#msg285173 I don't expect any significant performance impact for the change 6478e6d0476f. > Should inlining _PyStack_AsDict() be disabled too? Good question. I didn't try to write a benchmark calling this function. It would help to have numbers to take a decision. I tried to push the fewer changes which have the largest impact on the stack consumption. There is still room to reduce it even further. > Is it worth to extract slow paths of _PyObject_FastCallDict() and > _PyObject_FastCallKeywords() into separate non-inlined functions? Do you mean for performance or stack consumption? I don't know. If you would like to know, you should run a benchmark to measure that. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29234> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com