[issue29227] Reduce C stack consumption in function calls

STINNER Victor report at bugs.python.org
Tue Jan 10 12:50:46 EST 2017


New submission from STINNER Victor:

Attached patch reduce C stack consumption in function calls. It's the follow-up of the issue #28870.


Reference (rev a30cdf366c02):

test_python_call: 7175 calls before crash, stack: 1168 bytes/call
test_python_getitem: 6235 calls before crash, stack: 1344 bytes/call
test_python_iterator: 5344 calls before crash, stack: 1568 bytes/call

=> total: 18754 calls, 4080 bytes


With "Inline call_function() in ceval.c":

test_python_call: 7936 calls before crash, stack: 1056 bytes/call
test_python_getitem: 6387 calls before crash, stack: 1312 bytes/call
test_python_iterator: 5755 calls before crash, stack: 1456 bytes/call

=> total: 20078 calls, 3824 bytes


With inline and "_PY_FASTCALL_SMALL_STACK: 5 arg (40 B) => 3 arg (24 B)":

test_python_call: 8058 calls before crash, stack: 1040 bytes/call
test_python_getitem: 6630 calls before crash, stack: 1264 bytes/call
test_python_iterator: 5952 calls before crash, stack: 1408 bytes/call

=> total: 20640 calls, 3712 bytes


I applied testcapi_stack_pointer.patch and run stack_overflow_28870-sp.py of the issue #28870 to produce these statistics.

With the patch, Python 3.7 is still not as good as Python 3.5 (msg285109), but it's a first enhancement.

----------
components: Interpreter Core
files: less_stack.patch
keywords: patch
messages: 285135
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Reduce C stack consumption in function calls
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46242/less_stack.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29227>
_______________________________________


More information about the Python-bugs-list mailing list