From b4c64d12472bb618787168009eae103d59487ded Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Wed, 23 Feb 2022 00:05:49 +0100 Subject: [PATCH] adding init to non experiment too #299 --- benchmark/Benchmark.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/benchmark/Benchmark.ts b/benchmark/Benchmark.ts index e87a027f..1eec33b7 100644 --- a/benchmark/Benchmark.ts +++ b/benchmark/Benchmark.ts @@ -87,17 +87,22 @@ export class Benchmark { } async run(RUNS: number): Promise { - const ret = [await this.runAnExperiment(RUNS)]; + const ret: BenchmarkResult[] = []; + const r = async (): Promise => { + if (this.beforeAll) { + await this.beforeAll(); + } + ret.push(await this.runAnExperiment(RUNS)); + if (this.afterAll) { + await this.afterAll(); + } + }; + + await r(); for (const exp of Object.values(Experiments)) { for (const group of Object.values(exp.groups)) { ActiveExperiments[exp.name] = group; - if (this.beforeAll) { - await this.beforeAll(); - } - ret.push(await this.runAnExperiment(RUNS)); - if (this.afterAll) { - await this.afterAll(); - } + await r(); ret[ret.length - 1].experiment = exp.name + '=' + group; } delete ActiveExperiments[exp.name];