From b2c24c5cb586e48d6c21eff6c6d7386d863358bc Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 15:27:27 +0200 Subject: [PATCH 01/22] Add default tag --- JetStreamDriver.js | 154 +++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 81 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index d088eda..05303f3 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -404,8 +404,8 @@ class Driver { let text = ""; let newBenchmarks = []; for (const benchmark of this.benchmarks) { - const id = JSON.stringify(benchmark.constructor.scoreDescription()); - const description = JSON.parse(id); + const description = Array.from(Object.keys(benchmark.subScores())) + description.push("Score") newBenchmarks.push(benchmark); const scoreIds = benchmark.scoreIdentifiers() @@ -1012,7 +1012,6 @@ class Benchmark { return this._resourcesPromise; } - static scoreDescription() { throw new Error("Must be implemented by subclasses."); } scoreIdentifiers() { throw new Error("Must be implemented by subclasses"); } updateUIBeforeRun() { @@ -1095,10 +1094,6 @@ class DefaultBenchmark extends Benchmark { }; } - static scoreDescription() { - return ["First", "Worst", "Average", "Score"]; - } - scoreIdentifiers() { return [firstID(this), worst4ID(this), avgID(this), scoreID(this)]; } @@ -1313,10 +1308,6 @@ class WSLBenchmark extends Benchmark { }; } - static scoreDescription() { - return ["Stdlib", "MainRun", "Score"]; - } - scoreIdentifiers() { return ["wsl-stdlib-score", "wsl-tests-score", "wsl-score-score"]; } @@ -1489,10 +1480,6 @@ class WasmLegacyBenchmark extends Benchmark { }; } - static scoreDescription() { - return ["Startup", "Runtime", "Score"]; - } - get startupID() { return `wasm-startup-id${this.name}`; } @@ -1558,7 +1545,7 @@ let BENCHMARKS = [ , "./ARES-6/Air/payload-typescript-scanIdentifier.js" , "./ARES-6/Air/benchmark.js" ], - tags: ["ARES"], + tags: ["default", "ARES"], }), new DefaultBenchmark({ name: "Basic", @@ -1574,7 +1561,7 @@ let BENCHMARKS = [ , "./ARES-6/Basic/util.js" , "./ARES-6/Basic/benchmark.js" ], - tags: ["ARES"], + tags: ["default", "ARES"], }), new DefaultBenchmark({ name: "ML", @@ -1583,7 +1570,7 @@ let BENCHMARKS = [ , "./ARES-6/ml/benchmark.js" ], iterations: 60, - tags: ["ARES"], + tags: ["default", "ARES"], }), new DefaultBenchmark({ name: "Babylon", @@ -1597,7 +1584,7 @@ let BENCHMARKS = [ inspectorBlob: "./ARES-6/Babylon/inspector-blob.js", babylonBlob: "./ARES-6/Babylon/babylon-blob.js" }, - tags: ["ARES"], + tags: ["default", "ARES"], }), // CDJS new DefaultBenchmark({ @@ -1618,7 +1605,7 @@ let BENCHMARKS = [ ], iterations: 60, worstCaseCount: 3, - tags: ["CDJS"], + tags: ["default", "CDJS"], }), // CodeLoad new DefaultBenchmark({ @@ -1629,7 +1616,7 @@ let BENCHMARKS = [ preload: { inspectorPayloadBlob: "./code-load/inspector-payload-minified.js" }, - tags: ["CodeLoad"], + tags: ["default", "CodeLoad"], }), new DefaultBenchmark({ name: "multi-inspector-code-load", @@ -1639,7 +1626,7 @@ let BENCHMARKS = [ preload: { inspectorPayloadBlob: "./code-load/inspector-payload-minified.js" }, - tags: ["CodeLoad"], + tags: ["default", "CodeLoad"], }), // Octane new DefaultBenchmark({ @@ -1648,7 +1635,7 @@ let BENCHMARKS = [ "./Octane/box2d.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "octane-code-load", @@ -1656,7 +1643,7 @@ let BENCHMARKS = [ "./Octane/code-first-load.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "crypto", @@ -1664,7 +1651,7 @@ let BENCHMARKS = [ "./Octane/crypto.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "delta-blue", @@ -1672,7 +1659,7 @@ let BENCHMARKS = [ "./Octane/deltablue.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "earley-boyer", @@ -1680,7 +1667,7 @@ let BENCHMARKS = [ "./Octane/earley-boyer.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "gbemu", @@ -1689,7 +1676,7 @@ let BENCHMARKS = [ , "./Octane/gbemu-part2.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "mandreel", @@ -1698,7 +1685,7 @@ let BENCHMARKS = [ ], iterations: 80, deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "navier-stokes", @@ -1706,7 +1693,7 @@ let BENCHMARKS = [ "./Octane/navier-stokes.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "pdfjs", @@ -1714,14 +1701,14 @@ let BENCHMARKS = [ "./Octane/pdfjs.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "raytrace", files: [ "./Octane/raytrace.js" ], - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "regexp", @@ -1729,7 +1716,7 @@ let BENCHMARKS = [ "./Octane/regexp.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "richards", @@ -1737,7 +1724,7 @@ let BENCHMARKS = [ "./Octane/richards.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "splay", @@ -1745,7 +1732,7 @@ let BENCHMARKS = [ "./Octane/splay.js" ], deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), new DefaultBenchmark({ name: "typescript", @@ -1757,7 +1744,7 @@ let BENCHMARKS = [ iterations: 15, worstCaseCount: 2, deterministicRandom: true, - tags: ["Octane"], + tags: ["default", "Octane"], }), // RexBench new DefaultBenchmark({ @@ -1769,7 +1756,7 @@ let BENCHMARKS = [ , "./RexBench/FlightPlanner/expectations.js" , "./RexBench/FlightPlanner/benchmark.js" ], - tags: ["RexBench"], + tags: ["default", "RexBench"], }), new DefaultBenchmark({ name: "OfflineAssembler", @@ -1787,7 +1774,7 @@ let BENCHMARKS = [ , "./RexBench/OfflineAssembler/benchmark.js" ], iterations: 80, - tags: ["RexBench"], + tags: ["default", "RexBench"], }), new DefaultBenchmark({ name: "UniPoker", @@ -1797,7 +1784,7 @@ let BENCHMARKS = [ , "./RexBench/UniPoker/benchmark.js" ], deterministicRandom: true, - tags: ["RexBench"], + tags: ["default", "RexBench"], }), // Simple new DefaultBenchmark({ @@ -1805,21 +1792,21 @@ let BENCHMARKS = [ files: [ "./simple/hash-map.js" ], - tags: ["Simple"], + tags: ["default", "Simple"], }), new AsyncBenchmark({ name: "doxbee-promise", files: [ "./simple/doxbee-promise.js", ], - tags: ["Simple"], + tags: ["default", "Simple"], }), new AsyncBenchmark({ name: "doxbee-async", files: [ "./simple/doxbee-async.js", ], - tags: ["Simple"], + tags: ["default", "Simple"], }), // SeaMonster new DefaultBenchmark({ @@ -1827,14 +1814,14 @@ let BENCHMARKS = [ files: [ "./SeaMonster/ai-astar.js" ], - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "gaussian-blur", files: [ "./SeaMonster/gaussian-blur.js" ], - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-aes", @@ -1842,7 +1829,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-aes.js" ], - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-pbkdf2", @@ -1850,7 +1837,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-pbkdf2.js" ], - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-sha256", @@ -1858,7 +1845,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-sha256.js" ], - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "json-stringify-inspector", @@ -1868,7 +1855,7 @@ let BENCHMARKS = [ ], iterations: 20, worstCaseCount: 2, - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), new DefaultBenchmark({ name: "json-parse-inspector", @@ -1878,7 +1865,7 @@ let BENCHMARKS = [ ], iterations: 20, worstCaseCount: 2, - tags: ["SeaMonster"], + tags: ["default", "SeaMonster"], }), // BigInt new AsyncBenchmark({ @@ -1891,7 +1878,7 @@ let BENCHMARKS = [ iterations: 4, worstCaseCount: 1, deterministicRandom: true, - tags: ["BigIntNoble"], + tags: ["default", "BigIntNoble"], disabledByDefault: true, }), new AsyncBenchmark({ @@ -1902,7 +1889,7 @@ let BENCHMARKS = [ "./bigint/noble-benchmark.js", ], deterministicRandom: true, - tags: ["BigIntNoble"], + tags: ["default", "BigIntNoble"], disabledByDefault: true, }), new AsyncBenchmark({ @@ -1914,7 +1901,7 @@ let BENCHMARKS = [ ], iterations: 30, deterministicRandom: true, - tags: ["BigIntNoble"], + tags: ["default", "BigIntNoble"], }), new DefaultBenchmark({ name: "bigint-paillier", @@ -1926,7 +1913,7 @@ let BENCHMARKS = [ iterations: 10, worstCaseCount: 2, deterministicRandom: true, - tags: ["BigIntMisc"], + tags: ["default", "BigIntMisc"], disabledByDefault: true, }), new DefaultBenchmark({ @@ -1937,7 +1924,7 @@ let BENCHMARKS = [ ], iterations: 160, worstCaseCount: 16, - tags: ["BigIntMisc"], + tags: ["default", "BigIntMisc"], disabledByDefault: true, }), // Proxy @@ -1950,7 +1937,7 @@ let BENCHMARKS = [ ], iterations: defaultIterationCount * 3, worstCaseCount: defaultWorstCaseCount * 3, - tags: ["Proxy"], + tags: ["default", "Proxy"], }), new AsyncBenchmark({ name: "proxy-vue", @@ -1959,7 +1946,7 @@ let BENCHMARKS = [ "./proxy/vue-bundle.js", "./proxy/vue-benchmark.js", ], - tags: ["Proxy"] + tags: ["default", "Proxy"] }), // Class fields new DefaultBenchmark({ @@ -1967,14 +1954,14 @@ let BENCHMARKS = [ files: [ "./class-fields/raytrace-public-class-fields.js", ], - tags: ["ClassFields"] + tags: ["default", "ClassFields"] }), new DefaultBenchmark({ name: "raytrace-private-class-fields", files: [ "./class-fields/raytrace-private-class-fields.js", ], - tags: ["ClassFields"] + tags: ["default", "ClassFields"] }), // Generators new AsyncBenchmark({ @@ -1985,7 +1972,7 @@ let BENCHMARKS = [ iterations: 80, worstCaseCount: 6, deterministicRandom: true, - tags: ["Generators"] + tags: ["default", "Generators"] }), new DefaultBenchmark({ name: "sync-fs", @@ -1995,21 +1982,21 @@ let BENCHMARKS = [ iterations: 80, worstCaseCount: 6, deterministicRandom: true, - tags: ["Generators"] + tags: ["default", "Generators"] }), new DefaultBenchmark({ name: "lazy-collections", files: [ "./generators/lazy-collections.js", ], - tags: ["Generators"] + tags: ["default", "Generators"] }), new DefaultBenchmark({ name: "js-tokens", files: [ "./generators/js-tokens.js", ], - tags: ["Generators"] + tags: ["default", "Generators"] }), // Wasm new WasmEMCCBenchmark({ @@ -2022,7 +2009,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/HashSet/build/HashSet.wasm" }, iterations: 50, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "tsf-wasm", @@ -2034,7 +2021,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/TSF/build/tsf.wasm" }, iterations: 50, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "quicksort-wasm", @@ -2046,7 +2033,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/quicksort/build/quicksort.wasm" }, iterations: 50, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "gcc-loops-wasm", @@ -2058,7 +2045,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/gcc-loops/build/gcc-loops.wasm" }, iterations: 50, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "richards-wasm", @@ -2070,7 +2057,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/richards/build/richards.wasm" }, iterations: 50, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "sqlite3-wasm", @@ -2083,7 +2070,7 @@ let BENCHMARKS = [ }, iterations: 30, worstCaseCount: 2, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "Dart-flute-wasm", @@ -2095,7 +2082,7 @@ let BENCHMARKS = [ }, iterations: 15, worstCaseCount: 2, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmLegacyBenchmark({ name: "tfjs-wasm", @@ -2115,7 +2102,7 @@ let BENCHMARKS = [ }, async: true, deterministicRandom: true, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmLegacyBenchmark({ name: "tfjs-wasm-simd", @@ -2135,7 +2122,7 @@ let BENCHMARKS = [ }, async: true, deterministicRandom: true, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), new WasmEMCCBenchmark({ name: "argon2-wasm", @@ -2149,7 +2136,7 @@ let BENCHMARKS = [ iterations: 30, worstCaseCount: 3, deterministicRandom: true, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), // WorkerTests new AsyncBenchmark({ @@ -2186,7 +2173,7 @@ let BENCHMARKS = [ , stringUnpackCode: "./worker/bomb-subtests/string-unpack-code.js" , regexpDNA: "./worker/bomb-subtests/regexp-dna.js" }, - tags: ["WorkerTests"], + tags: ["default", "WorkerTests"], }), new AsyncBenchmark({ name: "segmentation", @@ -2198,13 +2185,13 @@ let BENCHMARKS = [ }, iterations: 36, worstCaseCount: 3, - tags: ["WorkerTests"], + tags: ["default", "WorkerTests"], }), // WSL new WSLBenchmark({ name: "WSL", files: ["./WSL/Node.js" ,"./WSL/Type.js" ,"./WSL/ReferenceType.js" ,"./WSL/Value.js" ,"./WSL/Expression.js" ,"./WSL/Rewriter.js" ,"./WSL/Visitor.js" ,"./WSL/CreateLiteral.js" ,"./WSL/CreateLiteralType.js" ,"./WSL/PropertyAccessExpression.js" ,"./WSL/AddressSpace.js" ,"./WSL/AnonymousVariable.js" ,"./WSL/ArrayRefType.js" ,"./WSL/ArrayType.js" ,"./WSL/Assignment.js" ,"./WSL/AutoWrapper.js" ,"./WSL/Block.js" ,"./WSL/BoolLiteral.js" ,"./WSL/Break.js" ,"./WSL/CallExpression.js" ,"./WSL/CallFunction.js" ,"./WSL/Check.js" ,"./WSL/CheckLiteralTypes.js" ,"./WSL/CheckLoops.js" ,"./WSL/CheckRecursiveTypes.js" ,"./WSL/CheckRecursion.js" ,"./WSL/CheckReturns.js" ,"./WSL/CheckUnreachableCode.js" ,"./WSL/CheckWrapped.js" ,"./WSL/Checker.js" ,"./WSL/CloneProgram.js" ,"./WSL/CommaExpression.js" ,"./WSL/ConstexprFolder.js" ,"./WSL/ConstexprTypeParameter.js" ,"./WSL/Continue.js" ,"./WSL/ConvertPtrToArrayRefExpression.js" ,"./WSL/DereferenceExpression.js" ,"./WSL/DoWhileLoop.js" ,"./WSL/DotExpression.js" ,"./WSL/DoubleLiteral.js" ,"./WSL/DoubleLiteralType.js" ,"./WSL/EArrayRef.js" ,"./WSL/EBuffer.js" ,"./WSL/EBufferBuilder.js" ,"./WSL/EPtr.js" ,"./WSL/EnumLiteral.js" ,"./WSL/EnumMember.js" ,"./WSL/EnumType.js" ,"./WSL/EvaluationCommon.js" ,"./WSL/Evaluator.js" ,"./WSL/ExpressionFinder.js" ,"./WSL/ExternalOrigin.js" ,"./WSL/Field.js" ,"./WSL/FindHighZombies.js" ,"./WSL/FlattenProtocolExtends.js" ,"./WSL/FlattenedStructOffsetGatherer.js" ,"./WSL/FloatLiteral.js" ,"./WSL/FloatLiteralType.js" ,"./WSL/FoldConstexprs.js" ,"./WSL/ForLoop.js" ,"./WSL/Func.js" ,"./WSL/FuncDef.js" ,"./WSL/FuncInstantiator.js" ,"./WSL/FuncParameter.js" ,"./WSL/FunctionLikeBlock.js" ,"./WSL/HighZombieFinder.js" ,"./WSL/IdentityExpression.js" ,"./WSL/IfStatement.js" ,"./WSL/IndexExpression.js" ,"./WSL/InferTypesForCall.js" ,"./WSL/Inline.js" ,"./WSL/Inliner.js" ,"./WSL/InstantiateImmediates.js" ,"./WSL/IntLiteral.js" ,"./WSL/IntLiteralType.js" ,"./WSL/Intrinsics.js" ,"./WSL/LateChecker.js" ,"./WSL/Lexer.js" ,"./WSL/LexerToken.js" ,"./WSL/LiteralTypeChecker.js" ,"./WSL/LogicalExpression.js" ,"./WSL/LogicalNot.js" ,"./WSL/LoopChecker.js" ,"./WSL/MakeArrayRefExpression.js" ,"./WSL/MakePtrExpression.js" ,"./WSL/NameContext.js" ,"./WSL/NameFinder.js" ,"./WSL/NameResolver.js" ,"./WSL/NativeFunc.js" ,"./WSL/NativeFuncInstance.js" ,"./WSL/NativeType.js" ,"./WSL/NativeTypeInstance.js" ,"./WSL/NormalUsePropertyResolver.js" ,"./WSL/NullLiteral.js" ,"./WSL/NullType.js" ,"./WSL/OriginKind.js" ,"./WSL/OverloadResolutionFailure.js" ,"./WSL/Parse.js" ,"./WSL/Prepare.js" ,"./WSL/Program.js" ,"./WSL/ProgramWithUnnecessaryThingsRemoved.js" ,"./WSL/PropertyResolver.js" ,"./WSL/Protocol.js" ,"./WSL/ProtocolDecl.js" ,"./WSL/ProtocolFuncDecl.js" ,"./WSL/ProtocolRef.js" ,"./WSL/PtrType.js" ,"./WSL/ReadModifyWriteExpression.js" ,"./WSL/RecursionChecker.js" ,"./WSL/RecursiveTypeChecker.js" ,"./WSL/ResolveNames.js" ,"./WSL/ResolveOverloadImpl.js" ,"./WSL/ResolveProperties.js" ,"./WSL/ResolveTypeDefs.js" ,"./WSL/Return.js" ,"./WSL/ReturnChecker.js" ,"./WSL/ReturnException.js" ,"./WSL/StandardLibrary.js" ,"./WSL/StatementCloner.js" ,"./WSL/StructLayoutBuilder.js" ,"./WSL/StructType.js" ,"./WSL/Substitution.js" ,"./WSL/SwitchCase.js" ,"./WSL/SwitchStatement.js" ,"./WSL/SynthesizeEnumFunctions.js" ,"./WSL/SynthesizeStructAccessors.js" ,"./WSL/TrapStatement.js" ,"./WSL/TypeDef.js" ,"./WSL/TypeDefResolver.js" ,"./WSL/TypeOrVariableRef.js" ,"./WSL/TypeParameterRewriter.js" ,"./WSL/TypeRef.js" ,"./WSL/TypeVariable.js" ,"./WSL/TypeVariableTracker.js" ,"./WSL/TypedValue.js" ,"./WSL/UintLiteral.js" ,"./WSL/UintLiteralType.js" ,"./WSL/UnificationContext.js" ,"./WSL/UnreachableCodeChecker.js" ,"./WSL/VariableDecl.js" ,"./WSL/VariableRef.js" ,"./WSL/VisitingSet.js" ,"./WSL/WSyntaxError.js" ,"./WSL/WTrapError.js" ,"./WSL/WTypeError.js" ,"./WSL/WhileLoop.js" ,"./WSL/WrapChecker.js", "./WSL/Test.js"], - tags: ["WSL"], + tags: ["default", "WSL"], }), // 8bitbench new WasmEMCCBenchmark({ @@ -2220,7 +2207,7 @@ let BENCHMARKS = [ }, iterations: 15, worstCaseCount: 2, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), // zlib-wasm new WasmEMCCBenchmark({ @@ -2233,7 +2220,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/zlib/build/zlib.wasm", }, iterations: 40, - tags: ["Wasm"], + tags: ["default", "Wasm"], }), ]; @@ -2250,7 +2237,7 @@ for (const test of luaJSFightTests) { files: [ `./LuaJSFight/${test}.js` ], - tags: ["LuaJSFight"], + tags: ["default", "LuaJSFight"], })); } @@ -2275,7 +2262,7 @@ for (const test of SUNSPIDER_TESTS) { files: [ `./SunSpider/${test}.js` ], - tags: ["SunSpider"], + tags: ["default", "SunSpider"], })); } @@ -2300,7 +2287,7 @@ for (const name of WTB_TESTS) { ], iterations: 5, worstCaseCount: 1, - tags: ["WTB"], + tags: ["default", "WTB"], })); } @@ -2315,6 +2302,8 @@ for (const benchmark of BENCHMARKS) { throw new Error(`Duplicate benchmark with name "${name}}"`); else benchmarksByName.set(name, benchmark); + + benchmark.tags.add("all"); for (const tag of benchmark.tags) { if (benchmarksByTag.has(tag)) @@ -2382,8 +2371,11 @@ function processTestList(testList) } } + if (typeof testList !== "undefined") { processTestList(testList); } else if (customTestList.length) { processTestList(customTestList); -} +} else { + enableBenchmarksByTag("default") +} From b7bf8606c778d28ce378f8e0a214258bc6b8b0ba Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 15:31:59 +0200 Subject: [PATCH 02/22] fix --- JetStreamDriver.js | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 05303f3..41984b5 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -631,7 +631,6 @@ class Benchmark { this.tags = new Set(plan.tags); this.iterations = getIterationCount(plan); this.isAsync = !!plan.isAsync; - this.disabledByDefault = !!plan.disabledByDefault; this.scripts = null; this._resourcesPromise = null; this._state = BenchmarkState.READY; @@ -1878,8 +1877,7 @@ let BENCHMARKS = [ iterations: 4, worstCaseCount: 1, deterministicRandom: true, - tags: ["default", "BigIntNoble"], - disabledByDefault: true, + tags: ["BigIntNoble"], }), new AsyncBenchmark({ name: "bigint-noble-secp256k1", @@ -1889,8 +1887,7 @@ let BENCHMARKS = [ "./bigint/noble-benchmark.js", ], deterministicRandom: true, - tags: ["default", "BigIntNoble"], - disabledByDefault: true, + tags: ["BigIntNoble"], }), new AsyncBenchmark({ name: "bigint-noble-ed25519", @@ -1913,8 +1910,7 @@ let BENCHMARKS = [ iterations: 10, worstCaseCount: 2, deterministicRandom: true, - tags: ["default", "BigIntMisc"], - disabledByDefault: true, + tags: ["BigIntMisc"], }), new DefaultBenchmark({ name: "bigint-bigdenary", @@ -1924,8 +1920,7 @@ let BENCHMARKS = [ ], iterations: 160, worstCaseCount: 16, - tags: ["default", "BigIntMisc"], - disabledByDefault: true, + tags: ["BigIntMisc"], }), // Proxy new AsyncBenchmark({ @@ -2315,16 +2310,6 @@ for (const benchmark of BENCHMARKS) { this.JetStream = new Driver(); -function enableBenchmarks(benchmarks, forceEnable = false) -{ - for (let benchmark of benchmarks) { - if (!forceEnable && benchmark.disabledByDefault) - return; - - JetStream.addBenchmark(benchmark); - } -} - function enableBenchmarksByName(name) { const benchmark = benchmarksByName.get(name); @@ -2336,7 +2321,7 @@ function enableBenchmarksByName(name) JetStream.addBenchmark(benchmark); } -function enableBenchmarksByTag(tag, forceEnable = false) +function enableBenchmarksByTag(tag) { const benchmarks = benchmarksByTag.get(tag); @@ -2345,12 +2330,8 @@ function enableBenchmarksByTag(tag, forceEnable = false) throw new Error(`Couldn't find tag named: ${tag}.\n Choices are ${validTags}`); } - for (const benchmark of benchmarks) { - if (!forceEnable && benchmark.disabledByDefault) - continue; - + for (const benchmark of benchmarks) JetStream.addBenchmark(benchmark); - } } function processTestList(testList) @@ -2362,10 +2343,9 @@ function processTestList(testList) else benchmarkNames = testList.split(/[\s,]/); - const forceEnable = true; for (const name of benchmarkNames) { if (benchmarksByTag.has(name)) - enableBenchmarksByTag(name, forceEnable); + enableBenchmarksByTag(name); else enableBenchmarksByName(name); } From 20bd123d1108f6f44bb007aa7483e6d9b0bc1caa Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 15:36:20 +0200 Subject: [PATCH 03/22] cleanup --- JetStreamDriver.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 41984b5..f2141b4 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -404,8 +404,8 @@ class Driver { let text = ""; let newBenchmarks = []; for (const benchmark of this.benchmarks) { - const description = Array.from(Object.keys(benchmark.subScores())) - description.push("Score") + const id = JSON.stringify(benchmark.constructor.scoreDescription()); + const description = JSON.parse(id); newBenchmarks.push(benchmark); const scoreIds = benchmark.scoreIdentifiers() @@ -1093,6 +1093,10 @@ class DefaultBenchmark extends Benchmark { }; } + static scoreDescription() { + return ["First", "Worst", "Average", "Score"]; + } + scoreIdentifiers() { return [firstID(this), worst4ID(this), avgID(this), scoreID(this)]; } @@ -1307,6 +1311,10 @@ class WSLBenchmark extends Benchmark { }; } + static scoreDescription() { + return ["Stdlib", "MainRun", "Score"]; + } + scoreIdentifiers() { return ["wsl-stdlib-score", "wsl-tests-score", "wsl-score-score"]; } @@ -1479,6 +1487,10 @@ class WasmLegacyBenchmark extends Benchmark { }; } + static scoreDescription() { + return ["Startup", "Runtime", "Score"]; + } + get startupID() { return `wasm-startup-id${this.name}`; } From 02b1e1b838a753bd70887db0b8f6702de6fa3825 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 15:37:02 +0200 Subject: [PATCH 04/22] partial revert --- JetStreamDriver.js | 1 + 1 file changed, 1 insertion(+) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index f2141b4..061bc4e 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -1011,6 +1011,7 @@ class Benchmark { return this._resourcesPromise; } + static scoreDescription() { throw new Error("Must be implemented by subclasses."); } scoreIdentifiers() { throw new Error("Must be implemented by subclasses"); } updateUIBeforeRun() { From c3756133b0838a50b2b2178b0033c7e3ea9f4f4d Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 15:53:02 +0200 Subject: [PATCH 05/22] fix --- JetStreamDriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 38680a3..d7d4bf3 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2245,7 +2245,7 @@ for (const test of luaJSFightTests) { files: [ `./LuaJSFight/${test}.js` ], - tags: ["default", "LuaJSFight"], + tags: ["LuaJSFight"], })); } From a87c7abd59a64cc92882bcd4447786634577c0da Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 16:21:48 +0200 Subject: [PATCH 06/22] disable WorkerTests in shells --- JetStreamDriver.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index d7d4bf3..e80f36f 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -643,6 +643,14 @@ class Benchmark { } get isSuccess() { return this._state = BenchmarkState.DONE; } + hasTag(...tags) { + for (tag of tags) { + if (this.tags.has(tag)) + return true; + } + return false; + } + get runnerCode() { return ` let __benchmark = new Benchmark(${this.iterations}); @@ -2334,7 +2342,7 @@ function enableBenchmarksByName(name) JetStream.addBenchmark(benchmark); } -function enableBenchmarksByTag(tag) +function enableBenchmarksByTag(tag, excludeTags) { const benchmarks = benchmarksByTag.get(tag); @@ -2343,10 +2351,14 @@ function enableBenchmarksByTag(tag) throw new Error(`Couldn't find tag named: ${tag}.\n Choices are ${validTags}`); } - for (const benchmark of benchmarks) + for (const benchmark of benchmarks) { + if (excludeTags && benchmark.hasTag(...excludeTags)) + continue JetStream.addBenchmark(benchmark); + } } + function processTestList(testList) { let benchmarkNames = []; @@ -2364,10 +2376,14 @@ function processTestList(testList) } } +const defaultDisabledTags = []; +if (!!isInBrowser) + defaultDisabledTags = ["WorkerTests"]; + if (typeof testList !== "undefined") { processTestList(testList); } else if (customTestList.length) { processTestList(customTestList); } else { - enableBenchmarksByTag("default") + enableBenchmarksByTag("default", defaultDisabledTags) } From bd08e893de7e612f0e758c87586637ac67df2f1e Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 16:34:58 +0200 Subject: [PATCH 07/22] fix --- JetStreamDriver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index e80f36f..56debcf 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -644,7 +644,7 @@ class Benchmark { get isSuccess() { return this._state = BenchmarkState.DONE; } hasTag(...tags) { - for (tag of tags) { + for (const tag of tags) { if (this.tags.has(tag)) return true; } @@ -2378,7 +2378,7 @@ function processTestList(testList) const defaultDisabledTags = []; if (!!isInBrowser) - defaultDisabledTags = ["WorkerTests"]; + defaultDisabledTags.push("WorkerTests"); if (typeof testList !== "undefined") { processTestList(testList); From 2579599065ff1b14b90029d3472ffaa848eac2a3 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 3 Jul 2025 16:42:49 +0200 Subject: [PATCH 08/22] fix default-disable --- JetStreamDriver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 56debcf..d73a873 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -643,7 +643,7 @@ class Benchmark { } get isSuccess() { return this._state = BenchmarkState.DONE; } - hasTag(...tags) { + hasAnyTag(...tags) { for (const tag of tags) { if (this.tags.has(tag)) return true; @@ -2352,7 +2352,7 @@ function enableBenchmarksByTag(tag, excludeTags) } for (const benchmark of benchmarks) { - if (excludeTags && benchmark.hasTag(...excludeTags)) + if (excludeTags && benchmark.hasAnyTag(...excludeTags)) continue JetStream.addBenchmark(benchmark); } @@ -2377,7 +2377,7 @@ function processTestList(testList) } const defaultDisabledTags = []; -if (!!isInBrowser) +if (!isInBrowser) defaultDisabledTags.push("WorkerTests"); if (typeof testList !== "undefined") { From 341d1941382270f804cf8aa07cc2d697aa5e823e Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 15:44:35 +0200 Subject: [PATCH 09/22] cleanup --- JetStreamDriver.js | 164 ++++++++++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 78 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 10e2e5d..d722fe6 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -52,14 +52,22 @@ function getIntParam(urlParams, key) { return value } +function getTestListParam(urlParams, key) { + if (globalThis.customTestList.length) + throw new Error(`Overriding previous customTestList=${globalThis.customTestList.join()} with ${key} url-parameter.`); + return urlParams.getAll(key); +} + if (typeof(URLSearchParams) !== "undefined") { const urlParameters = new URLSearchParams(window.location.search); shouldReport = urlParameters.has('report') && urlParameters.get('report').toLowerCase() == 'true'; globalThis.startDelay = getIntParam(urlParameters, "startDelay"); if (shouldReport && !globalThis.startDelay) globalThis.startDelay = 4000; - if (urlParameters.has('test')) - customTestList = urlParameters.getAll("test"); + if (urlParameters.has("tag")) + customTestList = getTestListParam(urlParameters, "tag"); + if (urlParameters.has("test")) + customTestList = getTestListParam(urlParameters, "test"); globalThis.testIterationCount = getIntParam(urlParameters, "iterationCount"); globalThis.testWorstCaseCount = getIntParam(urlParameters, "worstCaseCount"); } @@ -232,7 +240,7 @@ class Driver { this.isReady = false; this.isDone = false; this.errors = []; - this.benchmarks = []; + this.benchmarks = new Set(); this.blobDataCache = { }; this.loadCache = { }; this.counter = { }; @@ -241,8 +249,8 @@ class Driver { this.counter.failedPreloadResources = 0; } - addBenchmark(benchmark) { - this.benchmarks.push(benchmark); + enableBenchmark(benchmark) { + this.benchmarks.add(benchmark); benchmark.fetchResources(); } @@ -389,15 +397,14 @@ class Driver { prepareToRun() { - this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); + const newBenchmarks = Array.from(this.benchmarks); + newBenchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); let text = ""; - let newBenchmarks = []; - for (const benchmark of this.benchmarks) { + for (const benchmark of newBenchmarks) { const id = JSON.stringify(benchmark.constructor.scoreDescription()); const description = JSON.parse(id); - newBenchmarks.push(benchmark); const scoreIds = benchmark.scoreIdentifiers() const overallScoreId = scoreIds.pop(); @@ -618,7 +625,9 @@ class Benchmark { constructor(plan) { this.plan = plan; - this.tags = new Set(plan.tags); + this.tags = new Set(plan.tags.map(each => each.toLowerCase())); + if (this.tags.size != plan.tags.length) + throw new Error(`${this.name} got duplicate tags: ${plan.tags.join()}`); this.iterations = getIterationCount(plan); this.isAsync = !!plan.isAsync; this.scripts = null; @@ -635,7 +644,7 @@ class Benchmark { hasAnyTag(...tags) { for (const tag of tags) { - if (this.tags.has(tag)) + if (this.tags.has(tag.toLowerCase())) return true; } return false; @@ -1562,7 +1571,7 @@ let BENCHMARKS = [ , "./ARES-6/Air/payload-typescript-scanIdentifier.js" , "./ARES-6/Air/benchmark.js" ], - tags: ["default", "ARES"], + tags: ["Default", "ARES"], }), new DefaultBenchmark({ name: "Basic", @@ -1578,7 +1587,7 @@ let BENCHMARKS = [ , "./ARES-6/Basic/util.js" , "./ARES-6/Basic/benchmark.js" ], - tags: ["default", "ARES"], + tags: ["Default", "ARES"], }), new DefaultBenchmark({ name: "ML", @@ -1587,7 +1596,7 @@ let BENCHMARKS = [ , "./ARES-6/ml/benchmark.js" ], iterations: 60, - tags: ["default", "ARES"], + tags: ["Default", "ARES"], }), new AsyncBenchmark({ name: "Babylon", @@ -1601,7 +1610,7 @@ let BENCHMARKS = [ inspectorBlob: "./ARES-6/Babylon/inspector-blob.js", babylonBlob: "./ARES-6/Babylon/babylon-blob.js" }, - tags: ["default", "ARES"], + tags: ["Default", "ARES"], }), // CDJS new DefaultBenchmark({ @@ -1622,7 +1631,7 @@ let BENCHMARKS = [ ], iterations: 60, worstCaseCount: 3, - tags: ["default", "CDJS"], + tags: ["Default", "CDJS"], }), // CodeLoad new AsyncBenchmark({ @@ -1633,7 +1642,7 @@ let BENCHMARKS = [ preload: { inspectorPayloadBlob: "./code-load/inspector-payload-minified.js" }, - tags: ["default", "CodeLoad"], + tags: ["Default", "CodeLoad"], }), new AsyncBenchmark({ name: "multi-inspector-code-load", @@ -1643,7 +1652,7 @@ let BENCHMARKS = [ preload: { inspectorPayloadBlob: "./code-load/inspector-payload-minified.js" }, - tags: ["default", "CodeLoad"], + tags: ["Default", "CodeLoad"], }), // Octane new DefaultBenchmark({ @@ -1652,7 +1661,7 @@ let BENCHMARKS = [ "./Octane/box2d.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "octane-code-load", @@ -1660,7 +1669,7 @@ let BENCHMARKS = [ "./Octane/code-first-load.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "crypto", @@ -1668,7 +1677,7 @@ let BENCHMARKS = [ "./Octane/crypto.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "delta-blue", @@ -1676,7 +1685,7 @@ let BENCHMARKS = [ "./Octane/deltablue.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "earley-boyer", @@ -1684,7 +1693,7 @@ let BENCHMARKS = [ "./Octane/earley-boyer.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "gbemu", @@ -1693,7 +1702,7 @@ let BENCHMARKS = [ , "./Octane/gbemu-part2.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "mandreel", @@ -1702,7 +1711,7 @@ let BENCHMARKS = [ ], iterations: 80, deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "navier-stokes", @@ -1710,7 +1719,7 @@ let BENCHMARKS = [ "./Octane/navier-stokes.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "pdfjs", @@ -1718,14 +1727,14 @@ let BENCHMARKS = [ "./Octane/pdfjs.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "raytrace", files: [ "./Octane/raytrace.js" ], - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "regexp", @@ -1733,7 +1742,7 @@ let BENCHMARKS = [ "./Octane/regexp.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "richards", @@ -1741,7 +1750,7 @@ let BENCHMARKS = [ "./Octane/richards.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "splay", @@ -1749,7 +1758,7 @@ let BENCHMARKS = [ "./Octane/splay.js" ], deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), new DefaultBenchmark({ name: "typescript", @@ -1761,7 +1770,7 @@ let BENCHMARKS = [ iterations: 15, worstCaseCount: 2, deterministicRandom: true, - tags: ["default", "Octane"], + tags: ["Default", "Octane"], }), // RexBench new DefaultBenchmark({ @@ -1773,7 +1782,7 @@ let BENCHMARKS = [ , "./RexBench/FlightPlanner/expectations.js" , "./RexBench/FlightPlanner/benchmark.js" ], - tags: ["default", "RexBench"], + tags: ["Default", "RexBench"], }), new DefaultBenchmark({ name: "OfflineAssembler", @@ -1791,7 +1800,7 @@ let BENCHMARKS = [ , "./RexBench/OfflineAssembler/benchmark.js" ], iterations: 80, - tags: ["default", "RexBench"], + tags: ["Default", "RexBench"], }), new DefaultBenchmark({ name: "UniPoker", @@ -1801,7 +1810,7 @@ let BENCHMARKS = [ , "./RexBench/UniPoker/benchmark.js" ], deterministicRandom: true, - tags: ["default", "RexBench"], + tags: ["Default", "RexBench"], }), // Simple new DefaultBenchmark({ @@ -1809,21 +1818,21 @@ let BENCHMARKS = [ files: [ "./simple/hash-map.js" ], - tags: ["default", "Simple"], + tags: ["Default", "Simple"], }), new AsyncBenchmark({ name: "doxbee-promise", files: [ "./simple/doxbee-promise.js", ], - tags: ["default", "Simple"], + tags: ["Default", "Simple"], }), new AsyncBenchmark({ name: "doxbee-async", files: [ "./simple/doxbee-async.js", ], - tags: ["default", "Simple"], + tags: ["Default", "Simple"], }), // SeaMonster new DefaultBenchmark({ @@ -1831,14 +1840,14 @@ let BENCHMARKS = [ files: [ "./SeaMonster/ai-astar.js" ], - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "gaussian-blur", files: [ "./SeaMonster/gaussian-blur.js" ], - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-aes", @@ -1846,7 +1855,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-aes.js" ], - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-pbkdf2", @@ -1854,7 +1863,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-pbkdf2.js" ], - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "stanford-crypto-sha256", @@ -1862,7 +1871,7 @@ let BENCHMARKS = [ "./SeaMonster/sjlc.js" , "./SeaMonster/stanford-crypto-sha256.js" ], - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "json-stringify-inspector", @@ -1872,7 +1881,7 @@ let BENCHMARKS = [ ], iterations: 20, worstCaseCount: 2, - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), new DefaultBenchmark({ name: "json-parse-inspector", @@ -1882,7 +1891,7 @@ let BENCHMARKS = [ ], iterations: 20, worstCaseCount: 2, - tags: ["default", "SeaMonster"], + tags: ["Default", "SeaMonster"], }), // BigInt new AsyncBenchmark({ @@ -1916,7 +1925,7 @@ let BENCHMARKS = [ ], iterations: 30, deterministicRandom: true, - tags: ["default", "BigIntNoble"], + tags: ["Default", "BigIntNoble"], }), new DefaultBenchmark({ name: "bigint-paillier", @@ -1950,7 +1959,7 @@ let BENCHMARKS = [ ], iterations: defaultIterationCount * 3, worstCaseCount: defaultWorstCaseCount * 3, - tags: ["default", "Proxy"], + tags: ["Default", "Proxy"], }), new AsyncBenchmark({ name: "proxy-vue", @@ -1959,7 +1968,7 @@ let BENCHMARKS = [ "./proxy/vue-bundle.js", "./proxy/vue-benchmark.js", ], - tags: ["default", "Proxy"] + tags: ["Default", "Proxy"] }), // Class fields new DefaultBenchmark({ @@ -1967,14 +1976,14 @@ let BENCHMARKS = [ files: [ "./class-fields/raytrace-public-class-fields.js", ], - tags: ["default", "ClassFields"] + tags: ["Default", "ClassFields"] }), new DefaultBenchmark({ name: "raytrace-private-class-fields", files: [ "./class-fields/raytrace-private-class-fields.js", ], - tags: ["default", "ClassFields"] + tags: ["Default", "ClassFields"] }), // Generators new AsyncBenchmark({ @@ -1985,7 +1994,7 @@ let BENCHMARKS = [ iterations: 80, worstCaseCount: 6, deterministicRandom: true, - tags: ["default", "Generators"] + tags: ["Default", "Generators"] }), new DefaultBenchmark({ name: "sync-fs", @@ -1995,21 +2004,21 @@ let BENCHMARKS = [ iterations: 80, worstCaseCount: 6, deterministicRandom: true, - tags: ["default", "Generators"] + tags: ["Default", "Generators"] }), new DefaultBenchmark({ name: "lazy-collections", files: [ "./generators/lazy-collections.js", ], - tags: ["default", "Generators"] + tags: ["Default", "Generators"] }), new DefaultBenchmark({ name: "js-tokens", files: [ "./generators/js-tokens.js", ], - tags: ["default", "Generators"] + tags: ["Default", "Generators"] }), // Wasm new WasmEMCCBenchmark({ @@ -2022,7 +2031,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/HashSet/build/HashSet.wasm" }, iterations: 50, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "tsf-wasm", @@ -2034,7 +2043,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/TSF/build/tsf.wasm" }, iterations: 50, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "quicksort-wasm", @@ -2046,7 +2055,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/quicksort/build/quicksort.wasm" }, iterations: 50, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "gcc-loops-wasm", @@ -2058,7 +2067,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/gcc-loops/build/gcc-loops.wasm" }, iterations: 50, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "richards-wasm", @@ -2070,7 +2079,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/richards/build/richards.wasm" }, iterations: 50, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "sqlite3-wasm", @@ -2083,7 +2092,7 @@ let BENCHMARKS = [ }, iterations: 30, worstCaseCount: 2, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "Dart-flute-wasm", @@ -2096,7 +2105,7 @@ let BENCHMARKS = [ }, iterations: 15, worstCaseCount: 2, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmLegacyBenchmark({ name: "tfjs-wasm", @@ -2116,7 +2125,7 @@ let BENCHMARKS = [ }, async: true, deterministicRandom: true, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmLegacyBenchmark({ name: "tfjs-wasm-simd", @@ -2136,7 +2145,7 @@ let BENCHMARKS = [ }, async: true, deterministicRandom: true, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), new WasmEMCCBenchmark({ name: "argon2-wasm", @@ -2150,7 +2159,7 @@ let BENCHMARKS = [ iterations: 30, worstCaseCount: 3, deterministicRandom: true, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), // WorkerTests new AsyncBenchmark({ @@ -2187,7 +2196,7 @@ let BENCHMARKS = [ , stringUnpackCode: "./worker/bomb-subtests/string-unpack-code.js" , regexpDNA: "./worker/bomb-subtests/regexp-dna.js" }, - tags: ["default", "WorkerTests"], + tags: ["Default", "WorkerTests"], }), new AsyncBenchmark({ name: "segmentation", @@ -2199,13 +2208,13 @@ let BENCHMARKS = [ }, iterations: 36, worstCaseCount: 3, - tags: ["default", "WorkerTests"], + tags: ["Default", "WorkerTests"], }), // WSL new WSLBenchmark({ name: "WSL", files: ["./WSL/Node.js" ,"./WSL/Type.js" ,"./WSL/ReferenceType.js" ,"./WSL/Value.js" ,"./WSL/Expression.js" ,"./WSL/Rewriter.js" ,"./WSL/Visitor.js" ,"./WSL/CreateLiteral.js" ,"./WSL/CreateLiteralType.js" ,"./WSL/PropertyAccessExpression.js" ,"./WSL/AddressSpace.js" ,"./WSL/AnonymousVariable.js" ,"./WSL/ArrayRefType.js" ,"./WSL/ArrayType.js" ,"./WSL/Assignment.js" ,"./WSL/AutoWrapper.js" ,"./WSL/Block.js" ,"./WSL/BoolLiteral.js" ,"./WSL/Break.js" ,"./WSL/CallExpression.js" ,"./WSL/CallFunction.js" ,"./WSL/Check.js" ,"./WSL/CheckLiteralTypes.js" ,"./WSL/CheckLoops.js" ,"./WSL/CheckRecursiveTypes.js" ,"./WSL/CheckRecursion.js" ,"./WSL/CheckReturns.js" ,"./WSL/CheckUnreachableCode.js" ,"./WSL/CheckWrapped.js" ,"./WSL/Checker.js" ,"./WSL/CloneProgram.js" ,"./WSL/CommaExpression.js" ,"./WSL/ConstexprFolder.js" ,"./WSL/ConstexprTypeParameter.js" ,"./WSL/Continue.js" ,"./WSL/ConvertPtrToArrayRefExpression.js" ,"./WSL/DereferenceExpression.js" ,"./WSL/DoWhileLoop.js" ,"./WSL/DotExpression.js" ,"./WSL/DoubleLiteral.js" ,"./WSL/DoubleLiteralType.js" ,"./WSL/EArrayRef.js" ,"./WSL/EBuffer.js" ,"./WSL/EBufferBuilder.js" ,"./WSL/EPtr.js" ,"./WSL/EnumLiteral.js" ,"./WSL/EnumMember.js" ,"./WSL/EnumType.js" ,"./WSL/EvaluationCommon.js" ,"./WSL/Evaluator.js" ,"./WSL/ExpressionFinder.js" ,"./WSL/ExternalOrigin.js" ,"./WSL/Field.js" ,"./WSL/FindHighZombies.js" ,"./WSL/FlattenProtocolExtends.js" ,"./WSL/FlattenedStructOffsetGatherer.js" ,"./WSL/FloatLiteral.js" ,"./WSL/FloatLiteralType.js" ,"./WSL/FoldConstexprs.js" ,"./WSL/ForLoop.js" ,"./WSL/Func.js" ,"./WSL/FuncDef.js" ,"./WSL/FuncInstantiator.js" ,"./WSL/FuncParameter.js" ,"./WSL/FunctionLikeBlock.js" ,"./WSL/HighZombieFinder.js" ,"./WSL/IdentityExpression.js" ,"./WSL/IfStatement.js" ,"./WSL/IndexExpression.js" ,"./WSL/InferTypesForCall.js" ,"./WSL/Inline.js" ,"./WSL/Inliner.js" ,"./WSL/InstantiateImmediates.js" ,"./WSL/IntLiteral.js" ,"./WSL/IntLiteralType.js" ,"./WSL/Intrinsics.js" ,"./WSL/LateChecker.js" ,"./WSL/Lexer.js" ,"./WSL/LexerToken.js" ,"./WSL/LiteralTypeChecker.js" ,"./WSL/LogicalExpression.js" ,"./WSL/LogicalNot.js" ,"./WSL/LoopChecker.js" ,"./WSL/MakeArrayRefExpression.js" ,"./WSL/MakePtrExpression.js" ,"./WSL/NameContext.js" ,"./WSL/NameFinder.js" ,"./WSL/NameResolver.js" ,"./WSL/NativeFunc.js" ,"./WSL/NativeFuncInstance.js" ,"./WSL/NativeType.js" ,"./WSL/NativeTypeInstance.js" ,"./WSL/NormalUsePropertyResolver.js" ,"./WSL/NullLiteral.js" ,"./WSL/NullType.js" ,"./WSL/OriginKind.js" ,"./WSL/OverloadResolutionFailure.js" ,"./WSL/Parse.js" ,"./WSL/Prepare.js" ,"./WSL/Program.js" ,"./WSL/ProgramWithUnnecessaryThingsRemoved.js" ,"./WSL/PropertyResolver.js" ,"./WSL/Protocol.js" ,"./WSL/ProtocolDecl.js" ,"./WSL/ProtocolFuncDecl.js" ,"./WSL/ProtocolRef.js" ,"./WSL/PtrType.js" ,"./WSL/ReadModifyWriteExpression.js" ,"./WSL/RecursionChecker.js" ,"./WSL/RecursiveTypeChecker.js" ,"./WSL/ResolveNames.js" ,"./WSL/ResolveOverloadImpl.js" ,"./WSL/ResolveProperties.js" ,"./WSL/ResolveTypeDefs.js" ,"./WSL/Return.js" ,"./WSL/ReturnChecker.js" ,"./WSL/ReturnException.js" ,"./WSL/StandardLibrary.js" ,"./WSL/StatementCloner.js" ,"./WSL/StructLayoutBuilder.js" ,"./WSL/StructType.js" ,"./WSL/Substitution.js" ,"./WSL/SwitchCase.js" ,"./WSL/SwitchStatement.js" ,"./WSL/SynthesizeEnumFunctions.js" ,"./WSL/SynthesizeStructAccessors.js" ,"./WSL/TrapStatement.js" ,"./WSL/TypeDef.js" ,"./WSL/TypeDefResolver.js" ,"./WSL/TypeOrVariableRef.js" ,"./WSL/TypeParameterRewriter.js" ,"./WSL/TypeRef.js" ,"./WSL/TypeVariable.js" ,"./WSL/TypeVariableTracker.js" ,"./WSL/TypedValue.js" ,"./WSL/UintLiteral.js" ,"./WSL/UintLiteralType.js" ,"./WSL/UnificationContext.js" ,"./WSL/UnreachableCodeChecker.js" ,"./WSL/VariableDecl.js" ,"./WSL/VariableRef.js" ,"./WSL/VisitingSet.js" ,"./WSL/WSyntaxError.js" ,"./WSL/WTrapError.js" ,"./WSL/WTypeError.js" ,"./WSL/WhileLoop.js" ,"./WSL/WrapChecker.js", "./WSL/Test.js"], - tags: ["default", "WSL"], + tags: ["Default", "WSL"], }), // 8bitbench new WasmEMCCBenchmark({ @@ -2221,7 +2230,7 @@ let BENCHMARKS = [ }, iterations: 15, worstCaseCount: 2, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), // zlib-wasm new WasmEMCCBenchmark({ @@ -2234,7 +2243,7 @@ let BENCHMARKS = [ wasmBinary: "./wasm/zlib/build/zlib.wasm", }, iterations: 40, - tags: ["default", "Wasm"], + tags: ["Default", "Wasm"], }), ]; @@ -2276,7 +2285,7 @@ for (const test of SUNSPIDER_TESTS) { files: [ `./SunSpider/${test}.js` ], - tags: ["default", "SunSpider"], + tags: ["Default", "SunSpider"], })); } @@ -2301,7 +2310,7 @@ for (const name of WTB_TESTS) { ], iterations: 5, worstCaseCount: 1, - tags: ["default", "WTB"], + tags: ["Default", "WTB"], })); } @@ -2320,9 +2329,9 @@ for (const benchmark of BENCHMARKS) { benchmark.tags.add("all"); for (const tag of benchmark.tags) { - if (benchmarksByTag.has(tag)) + if (benchmarksByTag.has(tag)) { benchmarksByTag.get(tag).push(benchmark); - else + } else benchmarksByTag.set(tag, [benchmark]); } } @@ -2336,13 +2345,12 @@ function enableBenchmarksByName(name) if (!benchmark) throw new Error(`Couldn't find benchmark named "${name}"`); - // We only use this for test lists. - JetStream.addBenchmark(benchmark); + JetStream.enableBenchmark(benchmark); } function enableBenchmarksByTag(tag, excludeTags) { - const benchmarks = benchmarksByTag.get(tag); + const benchmarks = benchmarksByTag.get(tag.toLowerCase()); if (!benchmarks) { const validTags = Array.from(benchmarksByTag.keys()).join(", "); @@ -2352,7 +2360,7 @@ function enableBenchmarksByTag(tag, excludeTags) for (const benchmark of benchmarks) { if (excludeTags && benchmark.hasAnyTag(...excludeTags)) continue - JetStream.addBenchmark(benchmark); + JetStream.enableBenchmark(benchmark); } } @@ -2383,5 +2391,5 @@ if (typeof testList !== "undefined") { } else if (customTestList.length) { processTestList(customTestList); } else { - enableBenchmarksByTag("default", defaultDisabledTags) + enableBenchmarksByTag("Default", defaultDisabledTags) } From baa6935156ab0ac72d77af6bfb188dc1c85cb937 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 15:47:58 +0200 Subject: [PATCH 10/22] cleanup --- JetStreamDriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index d722fe6..cfdb4a5 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -398,7 +398,7 @@ class Driver { prepareToRun() { const newBenchmarks = Array.from(this.benchmarks); - newBenchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); + newBenchmarks.sort((a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? 1 : -1); let text = ""; for (const benchmark of newBenchmarks) { From cc87b28d01983b411a84cf3195afff1d57e46a4d Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 15:48:38 +0200 Subject: [PATCH 11/22] fix --- JetStreamDriver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index cfdb4a5..5b0c8fe 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2329,9 +2329,9 @@ for (const benchmark of BENCHMARKS) { benchmark.tags.add("all"); for (const tag of benchmark.tags) { - if (benchmarksByTag.has(tag)) { + if (benchmarksByTag.has(tag)) benchmarksByTag.get(tag).push(benchmark); - } else + else benchmarksByTag.set(tag, [benchmark]); } } From f194c0ae9748118c484763b2f1bc17d79de8accc Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 18:08:01 +0200 Subject: [PATCH 12/22] use lower-case for benchmark names as well. --- JetStreamDriver.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 5b0c8fe..164679f 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2319,7 +2319,7 @@ const benchmarksByName = new Map(); const benchmarksByTag = new Map(); for (const benchmark of BENCHMARKS) { - const name = benchmark.name; + const name = benchmark.name.toLowerCase(); if (benchmarksByName.has(name)) throw new Error(`Duplicate benchmark with name "${name}}"`); @@ -2340,7 +2340,7 @@ this.JetStream = new Driver(); function enableBenchmarksByName(name) { - const benchmark = benchmarksByName.get(name); + const benchmark = benchmarksByName.get(name.toLowerCase()); if (!benchmark) throw new Error(`Couldn't find benchmark named "${name}"`); @@ -2374,7 +2374,8 @@ function processTestList(testList) else benchmarkNames = testList.split(/[\s,]/); - for (const name of benchmarkNames) { + for (let name of benchmarkNames) { + name = name.toLowerCase(); if (benchmarksByTag.has(name)) enableBenchmarksByTag(name); else From ceb3e2dfc7faad84a113300d59d8d1e2a7d1d74c Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 18:09:13 +0200 Subject: [PATCH 13/22] add worker check --- JetStreamDriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 164679f..866cf49 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2384,7 +2384,7 @@ function processTestList(testList) } const defaultDisabledTags = []; -if (!isInBrowser) +if (globalThis.Worker) defaultDisabledTags.push("WorkerTests"); if (typeof testList !== "undefined") { From 4c7c1ae40afb5cbebcc874e92bb25483ec168002 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 18:09:33 +0200 Subject: [PATCH 14/22] add worker test --- JetStreamDriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 866cf49..df336dc 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2384,7 +2384,7 @@ function processTestList(testList) } const defaultDisabledTags = []; -if (globalThis.Worker) +if (!globalThis.Worker) defaultDisabledTags.push("WorkerTests"); if (typeof testList !== "undefined") { From c48ab489e7ff88f7fb146ddc28796d15511b0fe7 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 14 Jul 2025 18:45:58 +0200 Subject: [PATCH 15/22] skip worker tests again (for now) --- JetStreamDriver.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index df336dc..8b76373 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2384,7 +2384,8 @@ function processTestList(testList) } const defaultDisabledTags = []; -if (!globalThis.Worker) +// FIXME: add better support to run Worker tests in shells. +if (!isInBrowser) defaultDisabledTags.push("WorkerTests"); if (typeof testList !== "undefined") { From a9533f9ee06a83a2ba763a854d490e55e1942878 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 21 Jul 2025 10:35:11 +0200 Subject: [PATCH 16/22] fix order --- JetStreamDriver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index e173406..5ee19dd 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -254,6 +254,7 @@ class Driver { benchmark.fetchResources(); } + async start() { let statusElement = false; let summaryElement = false; @@ -397,9 +398,6 @@ class Driver { prepareToRun() { - const newBenchmarks = Array.from(this.benchmarks); - newBenchmarks.sort((a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? 1 : -1); - let text = ""; for (const benchmark of this.benchmarks) { const description = Object.keys(benchmark.subScores()); @@ -466,6 +464,8 @@ class Driver { async initialize() { if (isInBrowser) window.addEventListener("error", (e) => this.pushError("driver startup", e.error)); + this.benchmarks = Array.from(this.benchmarks); + this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); await this.prefetchResourcesForBrowser(); await this.fetchResources(); this.prepareToRun(); From cf2e2080d9fa8b537e7c77e21a4f7281b73bd2fa Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 21 Jul 2025 12:57:50 +0200 Subject: [PATCH 17/22] pre-format --- JetStreamDriver.js | 63 +++++++++++++++++++++++---------------------- tests/unit-tests.js | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 31 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 5ee19dd..31509c3 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -254,6 +254,29 @@ class Driver { benchmark.fetchResources(); } + enableBenchmarksByName(name) { + const benchmark = benchmarksByName.get(name.toLowerCase()); + + if (!benchmark) + throw new Error(`Couldn't find benchmark named "${name}"`); + + this.enableBenchmark(benchmark); + } + + enableBenchmarksByTag(tag, excludeTags) { + const benchmarks = benchmarksByTag.get(tag.toLowerCase()); + + if (!benchmarks) { + const validTags = Array.from(benchmarksByTag.keys()).join(", "); + throw new Error(`Couldn't find tag named: ${tag}.\n Choices are ${validTags}`); + } + + for (const benchmark of benchmarks) { + if (excludeTags && benchmark.hasAnyTag(...excludeTags)) + continue + this.enableBenchmark(benchmark); + } + } async start() { let statusElement = false; @@ -461,11 +484,15 @@ class Driver { }); } + initializeBenchmarks() { + this.benchmarks = Array.from(this.benchmarks); + this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); + } + async initialize() { if (isInBrowser) window.addEventListener("error", (e) => this.pushError("driver startup", e.error)); - this.benchmarks = Array.from(this.benchmarks); - this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); + this.initializeBenchmarks(); await this.prefetchResourcesForBrowser(); await this.fetchResources(); this.prepareToRun(); @@ -2317,32 +2344,6 @@ for (const benchmark of BENCHMARKS) { this.JetStream = new Driver(); -function enableBenchmarksByName(name) -{ - const benchmark = benchmarksByName.get(name.toLowerCase()); - - if (!benchmark) - throw new Error(`Couldn't find benchmark named "${name}"`); - - JetStream.enableBenchmark(benchmark); -} - -function enableBenchmarksByTag(tag, excludeTags) -{ - const benchmarks = benchmarksByTag.get(tag.toLowerCase()); - - if (!benchmarks) { - const validTags = Array.from(benchmarksByTag.keys()).join(", "); - throw new Error(`Couldn't find tag named: ${tag}.\n Choices are ${validTags}`); - } - - for (const benchmark of benchmarks) { - if (excludeTags && benchmark.hasAnyTag(...excludeTags)) - continue - JetStream.enableBenchmark(benchmark); - } -} - function processTestList(testList) { @@ -2356,9 +2357,9 @@ function processTestList(testList) for (let name of benchmarkNames) { name = name.toLowerCase(); if (benchmarksByTag.has(name)) - enableBenchmarksByTag(name); + this.JetStream.enableBenchmarksByTag(name); else - enableBenchmarksByName(name); + this.JetStream.enableBenchmarksByName(name); } } @@ -2372,5 +2373,5 @@ if (typeof testList !== "undefined") { } else if (customTestList.length) { processTestList(customTestList); } else { - enableBenchmarksByTag("Default", defaultDisabledTags) + this.JetStream.enableBenchmarksByTag("Default", defaultDisabledTags) } diff --git a/tests/unit-tests.js b/tests/unit-tests.js index 29fd07b..b9ade8e 100644 --- a/tests/unit-tests.js +++ b/tests/unit-tests.js @@ -7,8 +7,60 @@ function assertTrue(condition, message) { } } +function assertFalse(condition, message) { + if (condition) { + throw new Error(message || "Assertion failed"); + } +} + +function assertEquals(actual, expected, message) { + if (actual !== expected) { + throw new Error(message || `Expected ${expected}, but got ${actual}`); + } +} + (function testTagsAreStrings() { for (const benchmark of BENCHMARKS) { benchmark.tags.forEach(tag => assertTrue(typeof(tag) == "string")) } +})(); + + + +(function testTagsAll() { + for (const benchmark of BENCHMARKS) { + assertTrue(benchmark.tags instanceof Set); + assertTrue(benchmark.tags.size > 0); + assertTrue(benchmark.tags.has("all")); + assertFalse(benchmark.tags.has("All")); + } +})(); + + +(function testDriverBenchmarksOrder() { + const driver = new Driver(); + driver.enableBenchmarksByTag("all"); + assertEquals(driver.benchmarks.size, BENCHMARKS.length); + driver.initializeBenchmarks(); + assertEquals(driver.benchmarks.length, BENCHMARKS.length); + const names = driver.benchmarks.map(b => b.name.toLowerCase()).sort().reverse(); + for (let i = 0; i < names.length; i++) { + assertEquals(driver.benchmarks[i].name.toLowerCase(), names[i]); + } +})(); + + +(function testEnableByTag() { + const driverA = new Driver(); + const driverB = new Driver(); + driverA.enableBenchmarksByTag("Default"); + driverB.enableBenchmarksByTag("default"); + assertTrue(driverA.benchmarks.size > 0); + assertEquals(driverA.benchmarks.size, driverB.benchmarks.size); + const enabledBenchmarkNames = new Set( + Array.from(driverA.benchmarks).map(b => b.name)); + for (const benchmark of BENCHMARKS) { + if (benchmark.tags.has("default")) + assertTrue(enabledBenchmarkNames.has(benchmark.name)); + } })(); \ No newline at end of file From ab77b2a38b2eed8fb450ee50f6c1fe810d14d483 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 21 Jul 2025 13:00:13 +0200 Subject: [PATCH 18/22] add newline --- tests/unit-tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit-tests.js b/tests/unit-tests.js index b9ade8e..7260a3f 100644 --- a/tests/unit-tests.js +++ b/tests/unit-tests.js @@ -63,4 +63,4 @@ function assertEquals(actual, expected, message) { if (benchmark.tags.has("default")) assertTrue(enabledBenchmarkNames.has(benchmark.name)); } -})(); \ No newline at end of file +})(); From 7bda93983b6ddb965751183bb69039ca58c1adfa Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 21 Jul 2025 13:05:57 +0200 Subject: [PATCH 19/22] fix driver --- JetStreamDriver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 31509c3..286ce9d 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2357,9 +2357,9 @@ function processTestList(testList) for (let name of benchmarkNames) { name = name.toLowerCase(); if (benchmarksByTag.has(name)) - this.JetStream.enableBenchmarksByTag(name); + globalThis.JetStream.enableBenchmarksByTag(name); else - this.JetStream.enableBenchmarksByName(name); + globalThis.JetStream.enableBenchmarksByName(name); } } @@ -2373,5 +2373,5 @@ if (typeof testList !== "undefined") { } else if (customTestList.length) { processTestList(customTestList); } else { - this.JetStream.enableBenchmarksByTag("Default", defaultDisabledTags) + globalThis.JetStream.enableBenchmarksByTag("Default", defaultDisabledTags) } From 43f0836a35eb691bc65d711c24c5cafc6ba99901 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 29 Jul 2025 14:09:38 +0200 Subject: [PATCH 20/22] cleaap --- JetStreamDriver.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 286ce9d..35f27a2 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2345,6 +2345,8 @@ for (const benchmark of BENCHMARKS) { this.JetStream = new Driver(); +%DebugPrint(this.JetStream); + function processTestList(testList) { let benchmarkNames = []; From 7c6ba2196e4e10893be804dd9a35ae986d733b77 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 29 Jul 2025 14:21:39 +0200 Subject: [PATCH 21/22] merge main and address review comment --- JetStreamDriver.js | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 34d1594..5c68adc 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -220,15 +220,9 @@ class Driver { this.isReady = false; this.isDone = false; this.errors = []; -<<<<<<< HEAD this.benchmarks = new Set(); -||||||| 8c28a5f - this.benchmarks = []; -======= - this.benchmarks = []; // TODO: Cleanup / remove / merge `blobDataCache` and `loadCache` vs. // the global `fileLoader` cache. ->>>>>>> df197ef3b188771bcfb28b7b32565b281d337950 this.blobDataCache = { }; this.loadCache = { }; this.counter = { }; @@ -237,20 +231,10 @@ class Driver { this.counter.failedPreloadResources = 0; } -<<<<<<< HEAD enableBenchmark(benchmark) { + // TODO: Remove, make `this.benchmarks` immutable and set it once in the + // ctor instead of this and the global `addBenchmarksBy*` functions. this.benchmarks.add(benchmark); - benchmark.fetchResources(); -||||||| 8c28a5f - addBenchmark(benchmark) { - this.benchmarks.push(benchmark); - benchmark.fetchResources(); -======= - // TODO: Remove, make `this.benchmarks` immutable and set it once in the - // ctor instead of this and the global `addBenchmarksBy*` functions. - addBenchmark(benchmark) { - this.benchmarks.push(benchmark); ->>>>>>> df197ef3b188771bcfb28b7b32565b281d337950 } enableBenchmarksByName(name) { @@ -417,19 +401,9 @@ class Driver { return magicFrame; } -<<<<<<< HEAD - prepareToRun() - { -||||||| 8c28a5f - prepareToRun() - { - this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); - -======= prepareToRun() { this.benchmarks.sort((a, b) => a.plan.name.toLowerCase() < b.plan.name.toLowerCase() ? 1 : -1); ->>>>>>> df197ef3b188771bcfb28b7b32565b281d337950 let text = ""; for (const benchmark of this.benchmarks) { const description = Object.keys(benchmark.subScores()); @@ -500,16 +474,8 @@ class Driver { async initialize() { if (isInBrowser) window.addEventListener("error", (e) => this.pushError("driver startup", e.error)); -<<<<<<< HEAD this.initializeBenchmarks(); - await this.prefetchResourcesForBrowser(); - await this.fetchResources(); -||||||| 8c28a5f - await this.prefetchResourcesForBrowser(); - await this.fetchResources(); -======= await this.prefetchResources(); ->>>>>>> df197ef3b188771bcfb28b7b32565b281d337950 this.prepareToRun(); this.isReady = true; if (isInBrowser) { From f71a98d14586f1c7e615083c4387f6700b29be4c Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 29 Jul 2025 14:23:07 +0200 Subject: [PATCH 22/22] remove debug code --- JetStreamDriver.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 5c68adc..7e0eb62 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2347,8 +2347,6 @@ for (const benchmark of BENCHMARKS) { this.JetStream = new Driver(); -%DebugPrint(this.JetStream); - function processTestList(testList) { let benchmarkNames = [];