How to make Python run as fast (or faster) than Julia

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Feb 27 08:59:59 EST 2018


On Tue, 27 Feb 2018 11:27:21 +0000, bartc wrote:

[...]
>> The built-in generator is using a completely different algorithm
>> though, so rate of generation isn't the entire story. How long is the
>> period of the one you're using? (How long before it loops?)
> 
> I believe it's 5*2**1320480*(2**64-1) according to the author's comment.
> 
> I haven't tested that.

What, you haven't run a full period of the generator? I thought your code 
was fast! *wink*

Sorry, I couldn't resist... :-)

But for the record, if we could generate a million million numbers per 
second, that is one every picosecond, the total time would be of the 
order of 10**397504 years. That's a one followed by three hundred ninety-
seven thousand zeroes.


> (By looping I understand that to mean, before the same sequence starts
> again. Because as the numbers are 64 bits, individual numbers will
> inevitably be repeated from time to time.)

Yes, that's what the period means: how long it takes for the entire 
sequence to repeat, not just a single number.




-- 
Steve




More information about the Python-list mailing list