Message343134
| Author |
vstinner |
| Recipients |
benjamin.peterson, fweimer, gregory.p.smith, methane, nascheme, pitrou, skrah, tgrigg, twouters, vstinner |
| Date |
2019年05月22日.00:09:17 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1558483757.34.0.114918637339.issue27987@roundup.psfhosted.org> |
| In-reply-to |
| Content |
> It seems to me that we don't need to have the PyObject structure containing a Python float to be 16-byte aligned. If so, could we introduce a new obmalloc API that returns memory with 8-byte alignment, for use by objects that know they don't require 16-byte alignment? floatobject.c could use this API to avoid the 33% overhead.
PyMem_Malloc / PyObject_Malloc only have one parameter: "size". It knows nothing about the allocated structure.
bpo-18835 discussed the idea of adding a new API which accept an alignment parameter. The issue was closed because of the lack of concrete usage.
In the clang crash bpo-36618 (which decided us to fix this issue), C alignof() function was discussed:
https://bugs.python.org/issue36618#msg340279
Copy of serge-sans-paille's comment:
"@vstinner: once you have a portable version of alignof, you can deciding to *not* use the pool allocator if the required alignment is greater than 8B, or you could modify the pool allocator to take alignment information as an extra parameter?" |
|