[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

Serhiy Storchaka report at bugs.python.org
Wed Feb 27 07:46:41 EST 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Good questions Josh!

The size of the python binary has been increased from 17494944 bytes (17085 KiB) to 17657112 bytes (17243 KiB) -- by 1%.

I think that this change can not increase memory consumption, because the new code does not use the heap (the old code can allocate additional memory dynamically).

As for using the stack memory, it is not so clear. On one side, the new code allocates an array on the stack for references to all parameters, and this memory is left in use until you return from the function. On other side, the old code allocates a lot of variables and static-sized buffers, and creates several function frames, but this memory is released after the end of arguments parsing. I think that for non-recursive functions the new code has smaller stack memory consumption (while the function has less than several tens of parameters), but for recursive functions it can increase stack memory consumption. Although I do not know whether any of affected functions is recursive.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36127>
_______________________________________


More information about the Python-bugs-list mailing list