On 9/13/06, Francesc Altet <[EMAIL PROTECTED]> wrote:
El dt 12 de 09 del 2006 a les 13:28 -0600, en/na Travis Oliphant va
escriure:
> >[BTW, numpy.empty seems twice as slower in my machine. Why?
> >
> >
> >>>>Timer("a=numpy.empty (10000,dtype=numpy.complex128)", "import
> >>>>
> >>>>
> >numpy").repeat(3,10000)
> >[0.37033700942993164, 0.31780219078063965, 0.31607294082641602]
> >]
> >
> >
> Now, you are creating an empty array with 10000 elements in it.

Ups, my bad. So, here are the correct times for array creation:

>>> Timer("a=numpy.empty (10,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.083303928375244141, 0.080381870269775391, 0.077172040939331055]
>>> Timer("a=numpy.empty(100,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.086454868316650391, 0.084085941314697266, 0.083555936813354492]
>>> Timer("a=numpy.empty(1000,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.084996223449707031, 0.082299947738647461, 0.081347942352294922]
>>> Timer("a=numpy.empty(10000,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.31068897247314453, 0.30376386642456055 , 0.30176281929016113]
>>> Timer("a=numpy.empty(100000,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.42552995681762695, 0.36864185333251953, 0.36870002746582031]
>>> Timer("a= numpy.empty(1000000,dtype=numpy.complex128)", "import
numpy").repeat(3,10000)
[0.48045611381530762, 0.41251182556152344, 0.40645909309387207]

So, it seems that there are a certain time dependency with size

array of 10 elements       -->  7.7 us
array of 100 elements      -->  8.4 us
array of 1000 elements     -->  8.1 us
array of 10000 elements    --> 30.2 us
array of 100000 elements   --> 36.9 us
array of 1000000 elements  --> 40.6 us


The transition looks a bit like a cache effect, although I don't see why the cache should enter in. But all the allocations look pretty fast to me.

Chuck


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to