From b5aebe9fae8924a12bc4e2c37074462102c8a797 Mon Sep 17 00:00:00 2001 From: David-Emmanuel DIVERNOIS Date: Wed, 4 Dec 2024 14:54:34 +0100 Subject: [PATCH] Call makeGraph from setup in dynamic bench test --- benchmarks/js-reactivity-benchmarks/dynamic.bench.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/benchmarks/js-reactivity-benchmarks/dynamic.bench.ts b/benchmarks/js-reactivity-benchmarks/dynamic.bench.ts index 536f0f3..2bf09b2 100644 --- a/benchmarks/js-reactivity-benchmarks/dynamic.bench.ts +++ b/benchmarks/js-reactivity-benchmarks/dynamic.bench.ts @@ -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); @@ -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(); + }, + } ); }