[Python-Dev] Removing surplus fields from the frame object and not adding any new ones.
andrew.svetlov at gmail.com
Mon Apr 9 12:40:51 CEST 2012
Do you want to create `frame` and `f_namespaces` every function call
instead of single `frame` creation?
On Mon, Apr 9, 2012 at 11:56 AM, Mark Shannon <mark at hotpy.org> wrote:
> The frame object is a key object in CPython. It holds the state
> of a function invocation. Frame objects are allocated, initialised
> and deallocated at a rapid rate.
> Each extra field in the frame object requires extra work for each
> and every function invocation. Fewer fields in the frame object
> means less overhead for function calls, and cleaner simpler code.
> We have recently removed the f_yieldfrom field from the frame object.
> The f_exc_type, f->f_exc_value, f->f_exc_traceback fields which handle
> sys.exc_info() in generators could be moved to the generator object.
> The f_tstate field is redundant and, it would seem, dangerous
> The f_builtins, f_globals, f_locals fields could be combined into a
> single f_namespaces struct.
> Now PEP 419 proposes adding (yet) another field to the frame object.
> Please don't.
> Clean, concise data structures lead to clean, concise code.
> which we all know is a "good thing" :)
> Python-Dev mailing list
> Python-Dev at python.org
More information about the Python-Dev