
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/