How to make Python run as fast (or faster) than Julia
bartc
bc at freeuk.com
Mon Feb 26 13:52:54 EST 2018
On 26/02/2018 17:05, Ben Bacarisse wrote:
> bartc <bc at freeuk.com> writes:
>
>> A C version is given below. (One I may have messed around with, which
>> I'm not sure works properly. For an original, google for Marsaglia and
>> KISS64 or SUPRKISS64.)
>
> The version I know uses unsigned integers. Did you change then to signed?
Yeah, I don't know what I was doing with that version.
> For a Python version, go back to the original C and work from there.
The original C makes confusing use of macros and comma operators.
A version without macros or comma expressions is here (tweaked from
generated C):
https://pastebin.com/raw/k4jFK5TN
This runs the 1-billion loop in 6 seconds.
--
bartc
More information about the Python-list
mailing list