generators : random shootout

David Eppstein eppstein at ics.uci.edu
Fri Jan 11 16:49:46 EST 2002


In article <mailman.1010775915.30357.python-list at python.org>,
 "Mark McEahern" <marklists at mceahern.com> wrote:

> Oops, after tweaking the timing a bit, they seem to take the same amount of
> time:
> 
>     # using globals
>     $ gen.py 1000
>     8.163294467
>     0.010000 seconds.
> 
>     # using generators
>     $ gen2.py 1000
>     8.163294467
>     0.010000 seconds.

You don't think it's suspicious that they both take an amount of time with 
so many zeros at the end?  To me, it looks like they both take one 
least-measurable-unit of time.  You need to try again with much larger 
counts to get any useful information out of the experiment.
-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list