Re: [Numpy-discussion] list to array is slow

2010-07-22 Thread Skipper Seabold
On Thu, Jul 22, 2010 at 5:09 PM, marco cammarata wrote: > Hi, > > any idea why the simple code below is so slow ? > > import numpy as n > from time import time as t > > dims = (640,480) > m = n.random.random( dims ) > > l=[] > > for i in range(200): >        l.append(m) > > t0=t() > b=n.array(l) >

Re: [Numpy-discussion] list to array is slow

2010-07-22 Thread Ian Mallett
On Thu, Jul 22, 2010 at 2:09 PM, marco cammarata wrote: > To convert the list into an array takes about 5 sec ... > Not too familiar with typical speeds, but at a guess, perhaps because it must convert 61.4 million (640*480*200) values? Just to *count* that high with xrange takes 1.6 seconds for

[Numpy-discussion] list to array is slow

2010-07-22 Thread marco cammarata
Hi, any idea why the simple code below is so slow ? import numpy as n from time import time as t dims = (640,480) m = n.random.random( dims ) l=[] for i in range(200): l.append(m) t0=t() b=n.array(l) print t()-t0 To convert the list into an array takes about 5 sec ... Thanks, marco