Skip to content

Commit

Permalink
Call makeGraph from setup in dynamic bench test
Browse files Browse the repository at this point in the history
  • Loading branch information
divdavem committed Dec 4, 2024
1 parent 2461efc commit b5aebe9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions benchmarks/js-reactivity-benchmarks/dynamic.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,12 @@ const perfTests = [
];

for (const config of perfTests) {
const { graph, counter } = makeGraph(config);
let graphAndCounter: GraphAndCounter;

bench(
`dynamic ${config.name}`,
() => {
const { graph, counter } = graphAndCounter;
counter.count = 0;
const sum = runGraph(graph, config.iterations, config.readFraction);

Expand All @@ -322,6 +323,13 @@ for (const config of perfTests) {
expect(counter.count).toBe(config.expected.count);
}
},
{ throws: true, setup }
{
throws: true,
time: 5000,
setup() {
graphAndCounter = makeGraph(config);
setup();
},
}
);
}

0 comments on commit b5aebe9

Please sign in to comment.