[Python-Dev] Update on PEP 523 and adding a co_extra field to code objects (original) (raw)
Brett Cannon brett at python.org
Tue Aug 30 17:06:53 EDT 2016
- Previous message (by thread): [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects
- Next message (by thread): [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 30 Aug 2016 at 11:56 Serhiy Storchaka <storchaka at gmail.com> wrote:
On 30.08.16 21:20, Antoine Pitrou wrote: > On Tue, 30 Aug 2016 18:12:01 +0000 > Brett Cannon <brett at python.org> wrote: >>> Why not make it always a list? List objects are reasonably cheap in >>> memory and access time... (unlike dicts) >> >> Because I would prefer to avoid any form of unnecessary performance >> overhead for the common case. > > But the performance overhead of iterating over a 1-element list > is small enough (it's just an array access after a pointer dereference) > that it may not be larger than the overhead of the multiple tests and > conditional branches your example shows.
Iterating over a tuple is even faster. It needs one pointer dereference less.
I'll talk it over with Dino and see what he thinks.
And for memory efficiency we can use just a raw array of pointers.
I would rather not do that as that leads to having to track the end of the array, special memory cleanup, etc. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160830/252c4a66/attachment.html>
- Previous message (by thread): [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects
- Next message (by thread): [Python-Dev] Update on PEP 523 and adding a co_extra field to code objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]