This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients python-dev, serhiy.storchaka, steve.dower, vstinner
Date 2017-01-11.08:04:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:

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.
Date User Action Args
2017-01-11 08:04:34vstinnersetrecipients: + vstinner, python-dev, serhiy.storchaka, steve.dower
2017-01-11 08:04:34vstinnersetmessageid: <>
2017-01-11 08:04:34vstinnerlinkissue29234 messages
2017-01-11 08:04:34vstinnercreate