2011/5/24 Stefan Behnel <span dir="ltr"><<a href="mailto:stefan_ml@behnel.de">stefan_ml@behnel.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Maciej Fijalkowski, 24.05.2011 13:31:<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
CPython was not designed for CPU cache usage as far as I'm aware.<br>
</blockquote>
<br></div> That's a pretty bold statement to make on this list. Even if it wasn't originally "designed" for (efficient?) CPU cache usage, it's certainly been around for long enough to have received numerous performance tweaks in that regard.<br>
<font color="#888888">
<br>
Stefan</font></blockquote><div><br></div><div>Maybe a change on memory allocation granularity can help here.</div><div><br></div><div>Raising it to 16 and 32 bytes for 32 and 64 bits system respectively guarantees that an access to ob_refcnt and/or ob_type will put on the cache line some other information for the same object, which is usually required by itself (except for very simple ones, such as PyNone, PyEllipsis, etc.).<br>
</div><div><br></div><div>Think about a long, a tuple, a list, a dictionary, ecc.: all of them have some critical data after these fields, that most likely will be accessed after INCRef or type checking.</div><div><br></div>
<div>Regards,</div><div>Cesare</div>