Skip to content

Commit ff88901

Browse files
committed
We've decided we're only going to keep one BigInt test for now.
bigint-noble-ed25519 is the remaining BigInt test enabled by default as it appears to do the most interesting things with BigInts. The rest are now disabled by default. They will run if they're passed via a test list but are otherwise not enabled. To make this work there's a new property on `Benchmark`s/`plan`s that disables them by default.
1 parent 1ba3031 commit ff88901

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

JetStreamDriver.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ class Benchmark {
631631
this.tags = new Set(plan.tags);
632632
this.iterations = getIterationCount(plan);
633633
this.isAsync = !!plan.isAsync;
634+
this.disabledByDefault = !!plan.disabledByDefault;
634635
this.scripts = null;
635636
this._resourcesPromise = null;
636637
this._state = BenchmarkState.READY;
@@ -1879,6 +1880,7 @@ let BENCHMARKS = [
18791880
worstCaseCount: 1,
18801881
deterministicRandom: true,
18811882
tags: ["BigIntNoble"],
1883+
disabledByDefault: true,
18821884
}),
18831885
new AsyncBenchmark({
18841886
name: "bigint-noble-secp256k1",
@@ -1889,6 +1891,7 @@ let BENCHMARKS = [
18891891
],
18901892
deterministicRandom: true,
18911893
tags: ["BigIntNoble"],
1894+
disabledByDefault: true,
18921895
}),
18931896
new AsyncBenchmark({
18941897
name: "bigint-noble-ed25519",
@@ -1912,6 +1915,7 @@ let BENCHMARKS = [
19121915
worstCaseCount: 2,
19131916
deterministicRandom: true,
19141917
tags: ["BigIntMisc"],
1918+
disabledByDefault: true,
19151919
}),
19161920
new DefaultBenchmark({
19171921
name: "bigint-bigdenary",
@@ -1922,6 +1926,7 @@ let BENCHMARKS = [
19221926
iterations: 160,
19231927
worstCaseCount: 16,
19241928
tags: ["BigIntMisc"],
1929+
disabledByDefault: true,
19251930
}),
19261931
// Proxy
19271932
new AsyncBenchmark({
@@ -2309,17 +2314,28 @@ for (const benchmark of BENCHMARKS) {
23092314

23102315
this.JetStream = new Driver();
23112316

2317+
function enableBenchmarks(benchmarks, forceEnable = false)
2318+
{
2319+
for (let benchmark of benchmarks) {
2320+
if (!forceEnable && benchmark.disabledByDefault)
2321+
return;
2322+
2323+
JetStream.addBenchmark(benchmark);
2324+
}
2325+
}
2326+
23122327
function enableBenchmarksByName(name)
23132328
{
23142329
const benchmark = benchmarksByName.get(name);
23152330

2316-
if (benchmark)
2317-
JetStream.addBenchmark(benchmark);
2318-
else
2331+
if (!benchmark)
23192332
throw new Error(`Couldn't find benchmark named "${name}"`);
2333+
2334+
// We only use this for test lists.
2335+
JetStream.addBenchmark(benchmark);
23202336
}
23212337

2322-
function enableBenchmarksByTag(tag)
2338+
function enableBenchmarksByTag(tag, forceEnable = false)
23232339
{
23242340
const benchmarks = benchmarksByTag.get(tag);
23252341

@@ -2328,8 +2344,12 @@ function enableBenchmarksByTag(tag)
23282344
throw new Error(`Couldn't find tag named: ${tag}.\n Choices are ${validTags}`);
23292345
}
23302346

2331-
for (let benchmark of benchmarks)
2347+
for (const benchmark of benchmarks) {
2348+
if (!forceEnable && benchmark.disabledByDefault)
2349+
continue;
2350+
23322351
JetStream.addBenchmark(benchmark);
2352+
}
23332353
}
23342354

23352355
function processTestList(testList)
@@ -2341,9 +2361,10 @@ function processTestList(testList)
23412361
else
23422362
benchmarkNames = testList.split(/[\s,]/);
23432363

2364+
const forceEnable = true;
23442365
for (const name of benchmarkNames) {
23452366
if (benchmarksByTag.has(name))
2346-
enableBenchmarksByTag(name);
2367+
enableBenchmarksByTag(name, forceEnable);
23472368
else
23482369
enableBenchmarksByName(name);
23492370
}

0 commit comments

Comments
 (0)