generators : random shootout

Mark McEahern marklists at mceahern.com
Fri Jan 11 17:28:57 EST 2002


David Eppstein
> 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.

Excellent point, thanks!

    # the generator method
    $ gen2.py 1000000
    81.465763603
    11.446000 seconds.

    # the "old" method
    $ gen.py 1000000
    81.465763603
    6.610000 seconds.

So the old method is faster.

// mark




More information about the Python-list mailing list