I am going to release Numeric 24.0 today or tomorrow unless I hear from anybody about some changes that need to get made. -Travis
Hi, I was curious about the newly introduced array protocol in Numeric 24.0 (as well as in current numarray CVS), and wanted to check if there is better speed during Numeric <-> numarray objects conversion. There answer is "partially" affirmative:
import numarray import Numeric print numarray.__version__ 1.4.0 print Numeric.__version__ 24.0 from time import time a = numarray.arange(100*1000) t1=time();b=Numeric.array(a);time()-t1 # numarray --> Numeric 0.0021419525146484375 # It was 1.58109998703 with Numeric 23.8 !
So, numarray --> Numeric speed has been improved quite a lot On the other way round, Numeric to numarray is not as efficient:
Na = Numeric.arange(100*1000) t1=time();c=numarray.array(Na);time()-t1 # Numeric --> numarray 0.15217900276184082 # It is much slower than numarray --> Numeric
I guess that the numarray --> Numeric can be speed-up because:
t1=time();Nb=numarray.array(buffer(Na),typecode=Na.typecode(),shape=Na.shape);time()-t1 0.00017499923706054688 # Numeric --> numarray using the buffer protocol
So, I guess CVS numarray is still refining the array protocol. But the thing that mostly shocks me is why the array protocol is still allowing doing conversions with memory copies because, as you can see in the last example that uses a buffer protocol, a non-copy memory conversion is indeed possible for numarray --> Numeric. So the question is: Would the array protocol bring numarray <-> Numeric <-> Numeric3 conversions without memory copies or this is more a wish on my half than an actual possibility? Thanks and keep the nice work! --
0,0< Francesc Altet http://www.carabos.com/ V V Cárabos Coop. V. Enjoy Data "-"
participants (2)
-
Francesc Altet -
Travis Oliphant