Brian Kelley <[EMAIL PROTECTED]>:
>
> python:
> ======
> import operator
> data = range(50000) # test data
> 
> result = sum(data)

I just did a simple experiment (using the timeit module) comparing
the performance of sum(range(50000)) and sum(xrange(50000)), and the
latter gave a speedup factor of about 2.2 on my computer... Also,
allocating a list of size 50000 seems a bit wasteful just for
computing this sum :)

-- 
Magnus Lie Hetland                    Fall seven times, stand up eight
http://hetland.org                                  [Japanese proverb]
_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to