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 rhettinger
Recipients rhettinger
Date 2013-08-26.02:32:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377484371.18.0.399621580043.issue18835@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, we have little to no control over the alignment of memory returned by the PyMem functions.   

I suggest variants such as PyMem_Alloc32(n) and PyMem_Alloc64(n) to return suitably aligned data blocks.

GNU C provides memalign() for this purpose:  http://www.delorie.com/gnu/docs/glibc/libc_31.html
and the Microsoft C compiler has _aligned_malloc() for the same purpose: http://msdn.microsoft.com/en-us/library/8z34s9c6%28VS.80%29.aspx

A principal use case would be PyObject pointers where we want to keep all or most of the data fields in the same cache line (i.e. the fields for list, tuple, dict, and set objects).

Deques would benefit from having the deque blocks aligned to 64byte boundaries and never crossing page boundaries.  Set entries would benefit from 32byte alignment.
History
Date User Action Args
2013-08-26 02:32:51rhettingersetrecipients: + rhettinger
2013-08-26 02:32:51rhettingersetmessageid: <1377484371.18.0.399621580043.issue18835@psf.upfronthosting.co.za>
2013-08-26 02:32:51rhettingerlinkissue18835 messages
2013-08-26 02:32:50rhettingercreate