Hi,<br><br><div class="gmail_quote">2012/7/3 Stefan Behnel <span dir="ltr">&lt;<a href="mailto:stefan_ml@behnel.de" target="_blank">stefan_ml@behnel.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":3c5">I&#39;ve been working with one of the modules in the Python benchmark suite,<br>
namely nbody, and tried to make it run a little faster when compiled with<br>
Cython in PyPy. I managed to get a massive speed-up by avoiding some<br>
borrowed references during list iteration and using PySequence_GetItem()<br>
instead, but now some 50-60% of the runtime are spent in Py_DecRef().<br></div></blockquote><div><br></div><div>Don&#39;t forget that cpyext reference counts are quite different from CPython:</div><div>PySequence_GetItem() needs to *create* a PyObject structure, and the returned object has a refcount of 1.</div>
<div>Then Py_DECREF() will really *deallocate* the PyObject structure...</div><div><br></div><div>This is quite more expensive than the simple refcount increment/decrement done by CPython.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":3c5"><br>
OverflowError: array too large<br></div></blockquote><div><br></div><div>Looks like a ctypes bug to me. Which OS, Python, etc. are you using?</div></div><br clear="all"><div><br></div>-- <br>Amaury Forgeot d&#39;Arc<br>