Re: Performance comparison Q

Magnus Lie Hetland <[email protected]> Mon, 9 May 2005 21:26:15 +0200
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
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