<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 17, 2018 at 4:34 AM, Victor Stinner <span dir="ltr"><<a href="mailto:vstinner@redhat.com" target="_blank">vstinner@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
IMHO you need a different approach to implement optimizations. For<br>
example, use your objects which don't rely on the GIL to be<br>
consistent. Sadly, I have no experience with that and so cannot<br>
provide any example.<br></blockquote><div><br></div><div>I DO NOT understand the technical details, but IIUC, numpy releases the GIL while doing pure numpy operations.</div><div><br></div><div>(and I have experimented with it, and it does seem to be the case -- that is, you can get enhanced performance with computationally heavy numpy code an multiple threads)</div><div><br></div><div>So maybe some lessons learned there.</div><div><br></div><div>The key differences may be that numpy arrays are full-fledged python objects, but they are not (generally) containers of python objects -- that is, the actual values are i memory accessed via a C pointer. Whereas a PyList holds pointers to Python objects, so even if are confident in the stability of the list itself, the objects in the list may not be stable.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> For example, os.stat() writes into a memory block allocated<br>
by Python. But it's a raw memory block, it's much simpler than a<br>
Python object like a tuple.</blockquote><div><br></div><div>exactly. -- so is a numpy .data element</div><div><br></div><div>-CHB</div><div><br></div><div><br></div></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>