[Numpy-discussion] Performance of the array protocol

Travis Oliphant oliphant at ee.byu.edu
Tue Nov 1 08:19:01 EST 2005


Francesc Altet wrote:

>Hi,
>
>I'm trying to start using the array protocol for conversion between
>Numeric <--> numarray (and newcore in the future), but I'm a bit
>disappointed because of its performance. For numarray --> Numeric we
>have:
>  
>
The other factor in this discussion is that you are creating and sharing 
relatively small arrays.

The fromstring apporach is not a problem if all you need is a copy of 
the data for small arrays. 

The array protocol approach uses attribute lookups on an object.  This 
is going to have overhead that will only be useful for large arrays (or 
arrays that you want to have share the same data region).

So, I guess the answer to your question is that for small arrays it is 
an intrinsic limitation of the use of Python attributes in the array 
protocol.

-Travis





More information about the NumPy-Discussion mailing list