Skip to content

Switch to xoroshiro128plus#9

Open
grandchild wants to merge 1 commit intorxi:masterfrom
grandchild:xoroshiro128plus
Open

Switch to xoroshiro128plus#9
grandchild wants to merge 1 commit intorxi:masterfrom
grandchild:xoroshiro128plus

Conversation

@grandchild
Copy link

The authors of the previously-used xorshift128+ implementation suggest, in the reference source, to move to xoroshiro128+. The comments in that implementation mention some caveats about the fidelity of the lower bits and outputs beyond 5TB. So out of an absolute overabundance of caution one could switch to xoroshiro128++ instead of xoroshiro128+, which is slightly slower.

However it seems that this would not justify the slight increase in runtime. With a modified example.c running a large number of iterations before printing, xoroshiro128++ seems slightly slower, while xoroshiro128+ and xorshift128+ are about the same speed (accuracy is ~0.5sec in each case):

$ ./build.sh && time ./example # xorshift128+
Generated 100000000 iterations. Last UUID: a078c6b1-bd15-4018-8015-59ef66925a55
./example 11.33s user 0.00s system 99% cpu 11.372 total

$ ./build.sh && time ./example # xoroshiro128+
Generated 100000000 iterations. Last UUID: 0ab70d5e-0156-4830-a663-2e4fef1a45d6
./example 11.58s user 0.00s system 99% cpu 11.631 total

$ ./build.sh && time ./example # xoroshiro128++
Generated 100000000 iterations. Last UUID: 450d0a68-143b-45db-9d72-5c12125277c7
./example 12.45s user 0.00s system 99% cpu 12.499 total

@grandchild
Copy link
Author

Note that I'd consider this PR strictly optional. I think that switching algorithms is probably not necessary, but simply possible to be on the safe side.

The authors of the previously-used xorshift128+ implementation
suggest, in the reference source, to move to xoroshiro128+. The
comments in that implementation mention some caveats about the
fidelity of the lower bits and outputs beyond 5TB.
So out of an absolute overabundance of caution one could switch to
xoroshiro128++ instead of xoroshiro128+, which is slightly slower.

However it seems that this would not justify the slight increase in
runtime. With a modified example.c running a _large_ number of
iterations before printing, xoroshiro128++ seems slightly slower,
while xoroshiro128+ and xorshift128+ are about the same speed
(accuracy is ~0.5sec in each case):

  $ ./build.sh && time ./example  # xorshift128+
  Generated 100000000 iterations. Last UUID: a078c6b1-bd15-4018-8015-59ef66925a55
  ./example  11.33s user 0.00s system 99% cpu 11.372 total

  $ ./build.sh && time ./example  # xoroshiro128+
  Generated 100000000 iterations. Last UUID: 0ab70d5e-0156-4830-a663-2e4fef1a45d6
  ./example  11.58s user 0.00s system 99% cpu 11.631 total

  $ ./build.sh && time ./example  # xoroshiro128++
  Generated 100000000 iterations. Last UUID: 450d0a68-143b-45db-9d72-5c12125277c7
  ./example  12.45s user 0.00s system 99% cpu 12.499 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant