<p dir="ltr">On Nov 7, 2015 2:58 PM, "aerojockey" <<a href="mailto:pythondev1@aerojockey.com">pythondev1@aerojockey.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> Recently I made some changes to a program I'm working on, and found that the<br>
> changes made it four times slower than before.  After some digging, I found<br>
> out that one of the new costs was that I added structure arrays.  Inside a<br>
> low-level loop, I create a structure array, populate it Python, then turn it<br>
> over to some handwritten C code for processing.  It turned out that, when<br>
> passed a structure array as a dtype, numpy has to parse the dtype, which<br>
> included calls to re.match and eval.<br>
><br>
> Now, this is not a big deal for me to work around by using ordinary slicing<br>
> and such, and also I can improve things by reusing arrays.  Since this is<br>
> inner loop stuff, sacrificing readability for speed is an appropriate<br>
> tradeoff.<br>
><br>
> Nevertheless, I was curious if there was a way (or any plans for there to be<br>
> a way) to compile a struture array dtype.  I realize it's not the<br>
> bread-and-butter of numpy, but it turned out to be a very convenient feature<br>
> for my use case (populating an array of structures to pass off to C).</p>
<p dir="ltr">I was just looking into structured arrays. In case it is relevant:  Are you using certain 1.10? They are apparently a LOT slower than 1.9.3, an issue which will be fixed in a future version.</p>
<p dir="ltr">David</p>