This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients alex, benjamin.peterson, brett.cannon, christian.heimes, gregory.p.smith, neologix, pitrou, rhettinger, serhiy.storchaka
Date 2013-03-05.22:27:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362522479.48.0.147780207818.issue17338@psf.upfronthosting.co.za>
In-reply-to
Content
The gain will be more noticeable the faster the Python implementation it is running under is. It is going to avoid logN relloc's in just about all implementations.  That CPython is relatively slow is not a justification to avoid adding the feature.

I like Christian's proposal of not having it be a constructor argument but having it be a __preallocate__ method on the object.  That keeps it out of the eyes of most users reading the docs (keeping the main interface clear) and lets us put it in a special section of the python docs.  Code that *needs* it could use it but most would not need to bother.

Python VMs would be free to have dummy do nothing implementations (ie: we should *never* guarantee that a python call to thing.__preallocate__(1000) followed immediately by a C extension module call that takes thing as input can assume anything about the underlying object... it needs to check the size or resize itself before using the unchecked _SET_ITEM macros, etc.)
History
Date User Action Args
2013-03-05 22:27:59gregory.p.smithsetrecipients: + gregory.p.smith, brett.cannon, rhettinger, pitrou, christian.heimes, benjamin.peterson, alex, neologix, serhiy.storchaka
2013-03-05 22:27:59gregory.p.smithsetmessageid: <1362522479.48.0.147780207818.issue17338@psf.upfronthosting.co.za>
2013-03-05 22:27:59gregory.p.smithlinkissue17338 messages
2013-03-05 22:27:58gregory.p.smithcreate