[Numpy-discussion] Performance of the array protocol

David M. Cooke cookedm at physics.mcmaster.ca
Tue Nov 1 11:02:58 EST 2005

"Chris Barker" <Chris.Barker at noaa.gov> writes:

> Travis Oliphant wrote:
>> 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.
> IIRC, in the early discussion of the array protocol, we had talked about 
> defining a C struct, and a set of utilities to query that struct. Now, I 
> guess it uses Python attributes. Do I recall incorrectly, or has there 
> been a design change, or is this a prototype implementation? I guess I'd 
> like to see an array protocol that is as fast as fromstring(), even for 
> small arrays, though it's probably not a big deal. Also, when writing C 
> code to work with an array, it might be easier, as well as faster, to 
> not have to query Python attributes.

I had posted an idea before:


It would still be one attribute lookup, but then everything would be
C-based from there on.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the NumPy-Discussion mailing list