[Python-Dev] Removing surplus fields from the frame object and not adding any new ones.
Andrew Svetlov
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.
> (http://bugs.python.org/issue14230)
>> 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.
> (http://bugs.python.org/issue13897)
>> The f_tstate field is redundant and, it would seem, dangerous
> (http://bugs.python.org/issue14432)
>> The f_builtins, f_globals, f_locals fields could be combined into a
> single f_namespaces struct.
> (http://code.activestate.com/lists/python-dev/113381/)
>> 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" :)
>> Cheers,
> Mark.
>> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com
--
Thanks,
Andrew Svetlov
More information about the Python-Dev
mailing list