Add option to use old random and a benchmark
This commit is contained in:
parent
1e96d59ac8
commit
5d5159a08f
3 changed files with 99 additions and 1 deletions
46
packages/core/bench/signal.bench.mjs
Normal file
46
packages/core/bench/signal.bench.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { describe, bench } from 'vitest';
|
||||
|
||||
import { calculateSteps, rand, useOldRandom } from '../index.mjs';
|
||||
|
||||
const testingResolution = 1024;
|
||||
|
||||
const _generateRandomPattern = () => rand.iter(testingResolution).fast(testingResolution).firstCycle();
|
||||
|
||||
describe('random', () => {
|
||||
calculateSteps(true);
|
||||
bench(
|
||||
'+tactus',
|
||||
_generateRandomPattern,
|
||||
{ time: 1000 },
|
||||
);
|
||||
|
||||
calculateSteps(false);
|
||||
bench(
|
||||
'-tactus',
|
||||
_generateRandomPattern,
|
||||
{ time: 1000 },
|
||||
);
|
||||
});
|
||||
|
||||
describe('old random', () => {
|
||||
calculateSteps(true);
|
||||
bench(
|
||||
'+tactus',
|
||||
() => {
|
||||
useOldRandom();
|
||||
_generateRandomPattern();
|
||||
},
|
||||
{ time: 1000 },
|
||||
);
|
||||
|
||||
calculateSteps(false);
|
||||
bench(
|
||||
'-tactus',
|
||||
() => {
|
||||
useOldRandom();
|
||||
_generateRandomPattern();
|
||||
},
|
||||
{ time: 1000 },
|
||||
);
|
||||
});
|
||||
calculateSteps(true);
|
||||
Loading…
Add table
Add a link
Reference in a new issue