On Nov 7, 2015 2:58 PM, "aerojockey" <pythond...@aerojockey.com> wrote: > > Hello, > > Recently I made some changes to a program I'm working on, and found that the > changes made it four times slower than before. After some digging, I found > out that one of the new costs was that I added structure arrays. Inside a > low-level loop, I create a structure array, populate it Python, then turn it > over to some handwritten C code for processing. It turned out that, when > passed a structure array as a dtype, numpy has to parse the dtype, which > included calls to re.match and eval. > > Now, this is not a big deal for me to work around by using ordinary slicing > and such, and also I can improve things by reusing arrays. Since this is > inner loop stuff, sacrificing readability for speed is an appropriate > tradeoff. > > Nevertheless, I was curious if there was a way (or any plans for there to be > a way) to compile a struture array dtype. I realize it's not the > bread-and-butter of numpy, but it turned out to be a very convenient feature > for my use case (populating an array of structures to pass off to C).
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. David
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion