A Dilluns 28 Març 2005 23:54, Perry Greenfield va escriure:
Numarray, when it uses the buffer object, always gets a fresh pointer for the buffer object for every data access. But Scott is right that that pointer is good so long as there isn't a chance for something else to change it. In practice, I don't think that ever happens with the buffers that numarray happens to use, but it's still a flaw of the current buffer object that there is no way to ensure it won't change.
However, having to update the pointer for the buffer object for every data access does impact performance quite a lot. This issue has been brought up to this list some months ago (see [1]). I, as for one, have renounced to call NA_updateDataPtr() during table reads in PyTables and this speeded up the reading process by 70%, which is not a joke. And this speed-up could be theoretically achieved in every piece of code that reads like: for i range(n): a = numarrayobject[i] that is, whenever a single element in array is accessed. If the bytes object suggested by Scott makes the call to NA_updateDataPtr() unnecessary then this is an added advantage of bytes over buffer. [1] http://sourceforge.net/mailarchive/message.php?msg_id=8848962 Cheers, --
qo< Francesc Altet http://www.carabos.com/ V V Cárabos Coop. V. Enjoy Data ""