Skip to content

Commit 5be6cdc

Browse files
authored
Support custom benchmark arguments (#165)
For some benchmarks its easier to configure certain properties directly from the benchmark config.
1 parent b131126 commit 5be6cdc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

JetStreamDriver.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,16 @@ class Benchmark {
737737
return tags.some((tag) => this.tags.has(tag.toLowerCase()));
738738
}
739739

740+
get benchmarkArguments() {
741+
return {
742+
...this.plan.arguments,
743+
iterationCount: this.iterations,
744+
};
745+
}
746+
740747
get runnerCode() {
741748
return `{
742-
const benchmark = new Benchmark(${this.iterations});
749+
const benchmark = new Benchmark(${JSON.stringify(this.benchmarkArguments)});
743750
const results = [];
744751
const benchmarkName = "${this.name}";
745752
@@ -1400,7 +1407,7 @@ class WSLBenchmark extends Benchmark {
14001407

14011408
get runnerCode() {
14021409
return `{
1403-
const benchmark = new Benchmark();
1410+
const benchmark = new Benchmark(${JSON.stringify(this.benchmarkArguments)});
14041411
const benchmarkName = "${this.name}";
14051412
14061413
const results = [];

RexBench/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"use strict";
2626

2727
class Benchmark {
28-
constructor(verbose = 0)
28+
constructor({verbose = 0})
2929
{
3030
this._verbose = verbose;
3131
}

0 commit comments

Comments
 (0)