On 1/12/21 3:53 PM, Greg Ewing wrote:
On 13/01/21 5:47 am, Larry Hastings wrote:
instead of the compiler storing a code object as the annotations
argument to MAKE_FUNCTION, store a tuple containing the fields you'd
need to /recreate/ the code object at runtime--bytecode, lnotab,
names, consts, etc.
Would that tuple be significantly smaller than the corresponding
code object, though?
It would only be slightly smaller. The point of doing it would be to
boil out fields that change per-object (e.g. co_name) so that functions
with identical signatures would share the same tuple both in the .pyc
and at runtime. This idea is predicated on Inada-san's assertion that
this is an important memory optimization, that there are large
heavily-annotated projects with lots of functions/methods with identical
signatures where this memory savings is significant.
//arry/
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/QCARB4FO3DYT46U2R5VX5AQYZ4OW7K3I/
Code of Conduct: http://python.org/psf/codeofconduct/