strudel/bench/tunes.bench.mjs
Alex McLean e47d67a9da
Benchmarks (#1079)
* tactus-oriented benchmarks
* add benchmarks for individual example tunes
2024-05-03 10:52:56 +01:00

23 lines
668 B
JavaScript

import { queryCode, testCycles } from '../test/runtime.mjs';
import * as tunes from '../website/src/repl/tunes.mjs';
import { describe, bench } from 'vitest';
import { calculateTactus } from '../packages/core/index.mjs';
const tuneKeys = Object.keys(tunes);
describe('renders tunes', () => {
tuneKeys.forEach((key) => {
describe(key, () => {
calculateTactus(true);
bench(`+tactus`, async () => {
await queryCode(tunes[key], testCycles[key] || 1);
});
calculateTactus(false);
bench(`-tactus`, async () => {
await queryCode(tunes[key], testCycles[key] || 1);
});
calculateTactus(true);
});
});
});