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 vstinner
Recipients josh.r, jtaylor, neologix, njs, pitrou, skrah, vstinner
Date 2014-04-27.16:31:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398616316.22.0.571366717942.issue21233@psf.upfronthosting.co.za>
In-reply-to
Content
list: items are allocated in a second memory block. PyList_New() uses memset(0) to set all items to NULL.

tuple: header and items are stored in a single structure (PyTupleObject), in a single memory block. PyTuple_New() fills the items will NULL (so write again null bytes). Something can be optimized here.

dict: header, keys and values are stored in 3 different memory blocks. It may be interesting to use calloc() to allocate keys and values. Initialization of keys and values to NULL uses a dummy loop. I expect that memset(0) would be faster.

Anyway, I expect that all items of builtin containers (tuple, list, dict, etc.) are set to non-NULL values. So the lazy initialization to zeros may be useless for them.

It means that benchmarking builtin containers should not show any speedup. Something else (numpy?) should be used to see an interesting speedup.
History
Date User Action Args
2014-04-27 16:31:56vstinnersetrecipients: + vstinner, pitrou, njs, skrah, neologix, jtaylor, josh.r
2014-04-27 16:31:56vstinnersetmessageid: <1398616316.22.0.571366717942.issue21233@psf.upfronthosting.co.za>
2014-04-27 16:31:56vstinnerlinkissue21233 messages
2014-04-27 16:31:55vstinnercreate