[Numpy-discussion] Status of Numeric

Perry Greenfield perry at stsci.edu
Thu Jan 22 18:50:02 CST 2004


Robert Kern writes:
> [snip]
>
> Tim Hochberg writes:
 
> > The second point is the relative speediness of Numeric at low array 
> > sizes is the result that nearly all of it is implemented in C, whereas 
> > much of Numarray is implemented in Python. This results in a larger 
> > overhead for Numarray, which is why it's slower for small arrays. As I 
> > understand it, the decision to base most of Numarray in Python was 
> > driven by maintainability; it wasn't an attempt to optimize 
> large arrays 
> > at the expense of small ones.
> 
> Has the numarray team (or anyone else for that matter) looked at using
> Pyrex[1] to implement any part of numarray? If not, then that's my next
> free-time experiment (i.e. avoiding homework while still looking
> productive at the office).
>
We had looked at it at least a couple of times. I don't remember now
all the conclusions, but I think one of the problems was that
it wasn't as useful when one had to deal with data types not
used in python itself (e.g., unsigned int16). I might be wrong
about that. 

Numarray generates a lot of c code directly for the actual
array computations. That is neither the slow part, nor the
hard part to write. It is the array computation setup that
is complicated. Much of that is now in C (and we do worry
that it has greatly added to the complexity). Perhaps that
part could be better handled by pyrex.

I think some of the remaining overhead has to do with intrinsic
python calls, and the differences between the simpler type used
for Numeric versus the new style classes used for numarray. 
Don't hold me to that however.

Perry 





More information about the Numpy-discussion mailing list