Skip to content

Commit

Permalink
⚗️ Add some more self comparisons (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Feb 28, 2023
1 parent 6d3342d commit 44af2ad
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion perf/compare.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,34 @@ async function run() {
};
fisherYates(data, rand);
});
bench.add('pure-rand', () => {
bench.add('pure-rand (xorshift128plus)', () => {
const g = prand.xorshift128plus(seed);
const rand = (min, max) => {
return prand.unsafeUniformIntDistribution(min, max, g);
};
fisherYates(data, rand);
});
bench.add('pure-rand (xoroshiro128plus)', () => {
const g = prand.xoroshiro128plus(seed);
const rand = (min, max) => {
return prand.unsafeUniformIntDistribution(min, max, g);
};
fisherYates(data, rand);
});
bench.add('pure-rand (mersenne)', () => {
const g = prand.mersenne(seed);
const rand = (min, max) => {
return prand.unsafeUniformIntDistribution(min, max, g);
};
fisherYates(data, rand);
});
bench.add('pure-rand (congruential32)', () => {
const g = prand.congruential32(seed);
const rand = (min, max) => {
return prand.unsafeUniformIntDistribution(min, max, g);
};
fisherYates(data, rand);
});
bench.add('chance', () => {
const chance = new Chance();
const rand = (min, max) => {
Expand Down

0 comments on commit 44af2ad

Please sign in to comment.