PRNG comparison

JavaScript performance comparison

Revision 5 of this test case created

Preparation code

<script src="https://gist.github.com/kirbysayshi/1342599/raw/cd146576d84133ef260dca195804865e37da90ba/alea.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/76b04861a56ad22b076cf39a12fe4c91614615d7/kiss07.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/b832b0e522e72de0a932e2f4567e31336ceeec84/kybos.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/b3997929765c9f8bca5281bc0d32a753b2738eb5/lfib.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/a4a5a532601ad511a9841ab0ec60448dae4fd7c1/lfib4.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/5c6667bb9aca9228836eae19d0684647bbdc65c5/mash.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/f104ec805a7a1221fff055e6b7daaa452f86eda6/mrg32k3a.js"></script>
<script src="https://gist.github.com/kirbysayshi/1342599/raw/3a54bf50924a53154f99370e343feeddad2b601b/xorshift03.js"></script>

<script src="https://raw.github.com/chr15m/jsGameSoup/master/js/random.js"></script>

<script src="https://gist.github.com/banksean/300494/raw/f003af3e59a164330da573202f2372b94eb8ae47/mersenne-twister.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var seed = +new Date(),
    aleaGen = Alea(seed),
    kiss07Gen = KISS07(seed),
    kybosGen = Kybos(seed),
    lfibGen = LFib(seed),
    lfib4Gen = LFIB4(seed),
    mrg32k3aGen = MRG32k3a(seed),
    xorshift3Gen = Xorshift03(seed),
    seedableRandomGen = new SeedableRandom(),
    mersenneTwisterGen = new MersenneTwister()
   
   
    seedableRandomGen.seed(seed);
   
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
alea
aleaGen();
pending…
KISS07
kiss07Gen()
pending…
Kybos
kybosGen()
pending…
LFib
lfibGen()
pending…
LFIB4
lfib4Gen()
pending…
MRG32k3a
mrg32k3aGen()
pending…
Xorshift3
xorshift3Gen()
pending…
SeedableRandom
seedableRandomGen.next()
pending…
MersenneTwister
mersenneTwisterGen.random()
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment