Merge pull request #13 from camillobruni/2024-11-22_driver_prep

Directly use BenchmarkClass
This commit is contained in:
Keith Miller 2025-01-24 11:57:34 -05:00 committed by GitHub
commit 5c0b3411ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -248,8 +248,9 @@ class Driver {
this.counter.failedPreloadResources = 0;
}
addPlan(plan, BenchmarkClass = DefaultBenchmark) {
this.benchmarks.push(new BenchmarkClass(plan));
addBenchmark(benchmark) {
this.benchmarks.push(benchmark);
benchmark.fetchResources();
}
async start() {
@ -300,7 +301,7 @@ class Driver {
}
const allScores = [];
for (let benchmark of this.benchmarks)
for (const benchmark of this.benchmarks)
allScores.push(benchmark.score);
categoryScores = new Map;
@ -569,13 +570,14 @@ class Benchmark {
constructor(plan)
{
this.plan = plan;
this.testGroup = plan.testGroup;
this.iterations = getIterationCount(plan);
this.isAsync = !!plan.isAsync;
this.scripts = null;
this._resourcesPromise = null;
this.fetchResources();
}
get name() { return this.plan.name; }
@ -1462,10 +1464,9 @@ const WorkerTestsGroup = Symbol.for("WorkerTests");
const WSLGroup = Symbol.for("WSL");
const WTBGroup = Symbol.for("WTB");
const testPlans = [
const BENCHMARKS = [
// ARES
{
new DefaultBenchmark({
name: "Air",
files: [
"./ARES-6/Air/symbols.js"
@ -1491,8 +1492,8 @@ const testPlans = [
, "./ARES-6/Air/benchmark.js"
],
testGroup: ARESGroup
},
{
}),
new DefaultBenchmark({
name: "Basic",
files: [
"./ARES-6/Basic/ast.js"
@ -1507,8 +1508,8 @@ const testPlans = [
, "./ARES-6/Basic/benchmark.js"
],
testGroup: ARESGroup
},
{
}),
new DefaultBenchmark({
name: "ML",
files: [
"./ARES-6/ml/index.js"
@ -1516,8 +1517,8 @@ const testPlans = [
],
iterations: 60,
testGroup: ARESGroup
},
{
}),
new DefaultBenchmark({
name: "Babylon",
files: [
"./ARES-6/Babylon/index.js"
@ -1530,9 +1531,9 @@ const testPlans = [
babylonBlob: "./ARES-6/Babylon/babylon-blob.js"
},
testGroup: ARESGroup
},
}),
// CDJS
{
new DefaultBenchmark({
name: "cdjs",
files: [
"./cdjs/constants.js"
@ -1551,9 +1552,9 @@ const testPlans = [
iterations: 60,
worstCaseCount: 3,
testGroup: CDJSGroup
},
}),
// CodeLoad
{
new DefaultBenchmark({
name: "first-inspector-code-load",
files: [
"./code-load/code-first-load.js"
@ -1562,8 +1563,8 @@ const testPlans = [
inspectorPayloadBlob: "./code-load/inspector-payload-minified.js"
},
testGroup: CodeLoadGroup
},
{
}),
new DefaultBenchmark({
name: "multi-inspector-code-load",
files: [
"./code-load/code-multi-load.js"
@ -1572,49 +1573,49 @@ const testPlans = [
inspectorPayloadBlob: "./code-load/inspector-payload-minified.js"
},
testGroup: CodeLoadGroup
},
}),
// Octane
{
new DefaultBenchmark({
name: "Box2D",
files: [
"./Octane/box2d.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "octane-code-load",
files: [
"./Octane/code-first-load.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "crypto",
files: [
"./Octane/crypto.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "delta-blue",
files: [
"./Octane/deltablue.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "earley-boyer",
files: [
"./Octane/earley-boyer.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "gbemu",
files: [
"./Octane/gbemu-part1.js"
@ -1622,8 +1623,8 @@ const testPlans = [
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "mandreel",
files: [
"./Octane/mandreel.js"
@ -1631,55 +1632,55 @@ const testPlans = [
iterations: 80,
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "navier-stokes",
files: [
"./Octane/navier-stokes.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "pdfjs",
files: [
"./Octane/pdfjs.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "raytrace",
files: [
"./Octane/raytrace.js"
],
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "regexp",
files: [
"./Octane/regexp.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "richards",
files: [
"./Octane/richards.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "splay",
files: [
"./Octane/splay.js"
],
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "typescript",
files: [
"./Octane/typescript-compiler.js"
@ -1690,8 +1691,8 @@ const testPlans = [
worstCaseCount: 2,
deterministicRandom: true,
testGroup: OctaneGroup
},
{
}),
new DefaultBenchmark({
name: "octane-zlib",
files: [
"./Octane/zlib-data.js"
@ -1701,9 +1702,9 @@ const testPlans = [
worstCaseCount: 2,
deterministicRandom: true,
testGroup: OctaneGroup
},
}),
// RexBench
{
new DefaultBenchmark({
name: "FlightPlanner",
files: [
"./RexBench/FlightPlanner/airways.js"
@ -1713,8 +1714,8 @@ const testPlans = [
, "./RexBench/FlightPlanner/benchmark.js"
],
testGroup: RexBenchGroup
},
{
}),
new DefaultBenchmark({
name: "OfflineAssembler",
files: [
"./RexBench/OfflineAssembler/registers.js"
@ -1731,8 +1732,8 @@ const testPlans = [
],
iterations: 80,
testGroup: RexBenchGroup
},
{
}),
new DefaultBenchmark({
name: "UniPoker",
files: [
"./RexBench/UniPoker/poker.js"
@ -1741,71 +1742,69 @@ const testPlans = [
],
deterministicRandom: true,
testGroup: RexBenchGroup
},
}),
// Simple
{
new DefaultBenchmark({
name: "hash-map",
files: [
"./simple/hash-map.js"
],
testGroup: SimpleGroup
},
{
}),
new AsyncBenchmark({
name: "doxbee-promise",
files: [
"./simple/doxbee-promise.js",
],
benchmarkClass: AsyncBenchmark,
testGroup: SimpleGroup,
},
{
}),
new AsyncBenchmark({
name: "doxbee-async",
files: [
"./simple/doxbee-async.js",
],
benchmarkClass: AsyncBenchmark,
testGroup: SimpleGroup,
},
}),
// SeaMonster
{
new DefaultBenchmark({
name: "ai-astar",
files: [
"./SeaMonster/ai-astar.js"
],
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "gaussian-blur",
files: [
"./SeaMonster/gaussian-blur.js"
],
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "stanford-crypto-aes",
files: [
"./SeaMonster/sjlc.js"
, "./SeaMonster/stanford-crypto-aes.js"
],
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "stanford-crypto-pbkdf2",
files: [
"./SeaMonster/sjlc.js"
, "./SeaMonster/stanford-crypto-pbkdf2.js"
],
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "stanford-crypto-sha256",
files: [
"./SeaMonster/sjlc.js"
, "./SeaMonster/stanford-crypto-sha256.js"
],
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "json-stringify-inspector",
files: [
"./SeaMonster/inspector-json-payload.js"
@ -1814,8 +1813,8 @@ const testPlans = [
iterations: 20,
worstCaseCount: 2,
testGroup: SeaMonsterGroup
},
{
}),
new DefaultBenchmark({
name: "json-parse-inspector",
files: [
"./SeaMonster/inspector-json-payload.js"
@ -1824,9 +1823,9 @@ const testPlans = [
iterations: 20,
worstCaseCount: 2,
testGroup: SeaMonsterGroup
},
}),
// BigInt
{
new AsyncBenchmark({
name: "bigint-noble-bls12-381",
files: [
"./bigint/web-crypto-sham.js",
@ -1835,22 +1834,20 @@ const testPlans = [
],
iterations: 4,
worstCaseCount: 1,
benchmarkClass: AsyncBenchmark,
deterministicRandom: true,
testGroup: BigIntNobleGroup,
},
{
}),
new AsyncBenchmark({
name: "bigint-noble-secp256k1",
files: [
"./bigint/web-crypto-sham.js",
"./bigint/noble-secp256k1-bundle.js",
"./bigint/noble-benchmark.js",
],
benchmarkClass: AsyncBenchmark,
deterministicRandom: true,
testGroup: BigIntNobleGroup,
},
{
}),
new AsyncBenchmark({
name: "bigint-noble-ed25519",
files: [
"./bigint/web-crypto-sham.js",
@ -1858,11 +1855,10 @@ const testPlans = [
"./bigint/noble-benchmark.js",
],
iterations: 30,
benchmarkClass: AsyncBenchmark,
deterministicRandom: true,
testGroup: BigIntNobleGroup,
},
{
}),
new DefaultBenchmark({
name: "bigint-paillier",
files: [
"./bigint/web-crypto-sham.js",
@ -1873,8 +1869,8 @@ const testPlans = [
worstCaseCount: 2,
deterministicRandom: true,
testGroup: BigIntMiscGroup,
},
{
}),
new DefaultBenchmark({
name: "bigint-bigdenary",
files: [
"./bigint/bigdenary-bundle.js",
@ -1883,9 +1879,9 @@ const testPlans = [
iterations: 160,
worstCaseCount: 16,
testGroup: BigIntMiscGroup,
},
}),
// Proxy
{
new AsyncBenchmark({
name: "proxy-mobx",
files: [
"./proxy/common.js",
@ -1894,36 +1890,34 @@ const testPlans = [
],
iterations: defaultIterationCount * 3,
worstCaseCount: defaultWorstCaseCount * 3,
benchmarkClass: AsyncBenchmark,
testGroup: ProxyGroup,
},
{
}),
new AsyncBenchmark({
name: "proxy-vue",
files: [
"./proxy/common.js",
"./proxy/vue-bundle.js",
"./proxy/vue-benchmark.js",
],
benchmarkClass: AsyncBenchmark,
testGroup: ProxyGroup,
},
}),
// Class fields
{
new DefaultBenchmark({
name: "raytrace-public-class-fields",
files: [
"./class-fields/raytrace-public-class-fields.js",
],
testGroup: ClassFieldsGroup,
},
{
}),
new DefaultBenchmark({
name: "raytrace-private-class-fields",
files: [
"./class-fields/raytrace-private-class-fields.js",
],
testGroup: ClassFieldsGroup,
},
}),
// Generators
{
new AsyncBenchmark({
name: "async-fs",
files: [
"./generators/async-file-system.js",
@ -1931,10 +1925,9 @@ const testPlans = [
iterations: 80,
worstCaseCount: 6,
deterministicRandom: true,
benchmarkClass: AsyncBenchmark,
testGroup: GeneratorsGroup,
},
{
}),
new DefaultBenchmark({
name: "sync-fs",
files: [
"./generators/sync-file-system.js",
@ -1943,23 +1936,23 @@ const testPlans = [
worstCaseCount: 6,
deterministicRandom: true,
testGroup: GeneratorsGroup,
},
{
}),
new DefaultBenchmark({
name: "lazy-collections",
files: [
"./generators/lazy-collections.js",
],
testGroup: GeneratorsGroup,
},
{
}),
new DefaultBenchmark({
name: "js-tokens",
files: [
"./generators/js-tokens.js",
],
testGroup: GeneratorsGroup,
},
}),
// Wasm
{
new WasmLegacyBenchmark({
name: "HashSet-wasm",
files: [
"./wasm/HashSet.js"
@ -1967,10 +1960,9 @@ const testPlans = [
preload: {
wasmBinary: "./wasm/HashSet.wasm"
},
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
},
{
}),
new WasmEMCCBenchmark({
name: "tsf-wasm",
files: [
"./wasm/TSF/build/tsf.js",
@ -1979,12 +1971,11 @@ const testPlans = [
preload: {
wasmBinary: "./wasm/TSF/build/tsf.wasm"
},
benchmarkClass: WasmEMCCBenchmark,
iterations: 15,
worstCaseCount: 2,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "quicksort-wasm",
files: [
"./wasm/quicksort.js"
@ -1992,10 +1983,9 @@ const testPlans = [
preload: {
wasmBinary: "./wasm/quicksort.wasm"
},
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
},
{
}),
new WasmEMCCBenchmark({
name: "gcc-loops-wasm",
files: [
"./wasm/gcc-loops/build/gcc-loops.js",
@ -2004,11 +1994,10 @@ const testPlans = [
preload: {
wasmBinary: "./wasm/gcc-loops/build/gcc-loops.wasm"
},
benchmarkClass: WasmEMCCBenchmark,
iterations: 50,
testGroup: WasmGroup
},
{
}),
new WasmEMCCBenchmark({
name: "richards-wasm",
files: [
"./wasm/richards/build/richards.js",
@ -2017,12 +2006,11 @@ const testPlans = [
preload: {
wasmBinary: "./wasm/richards/build/richards.wasm"
},
benchmarkClass: WasmEMCCBenchmark,
iterations: 20,
worstCaseCount: 2,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "sqlite3-wasm",
files: [
"./sqlite3/polyfills.js",
@ -2034,8 +2022,8 @@ const testPlans = [
},
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "tfjs-wasm",
files: [
"./wasm/tfjs-model-helpers.js",
@ -2051,12 +2039,11 @@ const testPlans = [
preload: {
tfjsBackendWasmBlob: "./wasm/tfjs-backend-wasm.wasm",
},
benchmarkClass: WasmLegacyBenchmark,
async: true,
deterministicRandom: true,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "tfjs-wasm-simd",
files: [
"./wasm/tfjs-model-helpers.js",
@ -2072,12 +2059,11 @@ const testPlans = [
preload: {
tfjsBackendWasmSimdBlob: "./wasm/tfjs-backend-wasm-simd.wasm",
},
benchmarkClass: WasmLegacyBenchmark,
async: true,
deterministicRandom: true,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "argon2-wasm",
files: [
"./wasm/argon2-bundle.js",
@ -2087,10 +2073,9 @@ const testPlans = [
preload: {
argon2WasmBlob: "./wasm/argon2.wasm",
},
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
},
{
}),
new WasmLegacyBenchmark({
name: "argon2-wasm-simd",
files: [
"./wasm/argon2-bundle.js",
@ -2100,11 +2085,10 @@ const testPlans = [
preload: {
argon2WasmSimdBlob: "./wasm/argon2-simd.wasm",
},
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
},
}),
// WorkerTests
{
new AsyncBenchmark({
name: "bomb-workers",
files: [
"./worker/bomb.js"
@ -2138,10 +2122,9 @@ const testPlans = [
, stringUnpackCode: "./worker/bomb-subtests/string-unpack-code.js"
, regexpDNA: "./worker/bomb-subtests/regexp-dna.js"
},
benchmarkClass: AsyncBenchmark,
testGroup: WorkerTestsGroup
},
{
}),
new AsyncBenchmark({
name: "segmentation",
files: [
"./worker/segmentation.js"
@ -2151,18 +2134,16 @@ const testPlans = [
},
iterations: 36,
worstCaseCount: 3,
benchmarkClass: AsyncBenchmark,
testGroup: WorkerTestsGroup
},
}),
// 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"],
benchmarkClass: WSLBenchmark,
testGroup: WSLGroup
},
}),
// 8bitbench
{
new WasmLegacyBenchmark({
name: "8bitbench-wasm",
files: [
"./8bitbench/lib/fast-text-encoding-1.0.3/text.js",
@ -2174,9 +2155,8 @@ const testPlans = [
romBinary: "./8bitbench/assets/program.bin"
},
async: true,
benchmarkClass: WasmLegacyBenchmark,
testGroup: WasmGroup
}
})
];
// LuaJSFight tests
@ -2187,17 +2167,17 @@ const luaJSFightTests = [
, "string_lists"
];
for (const test of luaJSFightTests) {
testPlans.push({
BENCHMARKS.push(new DefaultBenchmark({
name: `${test}-LJF`,
files: [
`./LuaJSFight/${test}.js`
],
testGroup: LuaJSFightGroup
});
}));
}
// SunSpider tests
const sunSpiderTests = [
const SUNSPIDER_TESTS = [
"3d-cube"
, "3d-raytrace"
, "base64"
@ -2211,18 +2191,18 @@ const sunSpiderTests = [
, "string-unpack-code"
, "tagcloud"
];
for (const test of sunSpiderTests) {
testPlans.push({
for (const test of SUNSPIDER_TESTS) {
BENCHMARKS.push(new DefaultBenchmark({
name: `${test}-SP`,
files: [
`./SunSpider/${test}.js`
],
testGroup: SunSpiderGroup
});
}));
}
// WTB (Web Tooling Benchmark) tests
const WTBTests = [
const WTB_TESTS = [
"acorn"
, "babylon"
, "chai"
@ -2233,8 +2213,8 @@ const WTBTests = [
, "prepack"
, "uglify-js"
];
for (const name of WTBTests) {
testPlans.push({
for (const name of WTB_TESTS) {
BENCHMARKS.push(new DefaultBenchmark({
name: `${name}-wtb`,
files: [
isInBrowser ? "./web-tooling-benchmark/browser.js" : "./web-tooling-benchmark/cli.js"
@ -2243,69 +2223,67 @@ for (const name of WTBTests) {
iterations: 5,
worstCaseCount: 1,
testGroup: WTBGroup
});
}));
}
const testsByName = new Map();
const testsByGroup = new Map();
const benchmarksByName = new Map();
const benchmarksByGroup = new Map();
for (const plan of testPlans) {
const testName = plan.name;
for (const benchmark of BENCHMARKS) {
const testName = benchmark.name;
if (testsByName.has(plan.name))
if (benchmarksByName.has(benchmark.name))
throw "Duplicate test plan with name \"" + testName + "\"";
else
testsByName.set(testName, plan);
benchmarksByName.set(testName, benchmark);
const group = plan.testGroup;
const group = benchmark.testGroup;
if (testsByGroup.has(group))
testsByGroup.get(group).push(testName);
if (benchmarksByGroup.has(group))
benchmarksByGroup.get(group).push(testName);
else
testsByGroup.set(group, [testName]);
benchmarksByGroup.set(group, [testName]);
}
this.JetStream = new Driver();
function addTestByName(testName)
function enableBenchmarksByName(testName)
{
let plan = testsByName.get(testName);
const benchmark = benchmarksByName.get(testName);
if (plan)
JetStream.addPlan(plan, plan.benchmarkClass);
if (benchmark)
JetStream.addBenchmark(benchmark);
else
throw "Couldn't find test named \"" + testName + "\"";
}
function addTestsByGroup(group)
function enableBenchmarksByGroup(groupSymbol)
{
let testList = testsByGroup.get(group);
const benchmarkNames = benchmarksByGroup.get(groupSymbol);
if (!testList)
throw "Couldn't find test group named: \"" + Symbol.keyFor(group) + "\"";
if (!benchmarkNames)
throw "Couldn't find test group named: \"" + Symbol.keyFor(groupSymbol) + "\"";
for (let testName of testList)
addTestByName(testName);
for (let name of benchmarkNames)
enableBenchmarksByName(name);
}
function processTestList(testList)
{
let tests = [];
let benchmarkNames = [];
if (testList instanceof Array)
tests = testList;
benchmarkNames = testList;
else
tests = testList.split(/[\s,]/);
benchmarkNames = testList.split(/[\s,]/);
for (const testName of tests) {
const groupTest = testsByGroup.get(Symbol.for(testName));
if (groupTest) {
for (const testName of groupTest)
addTestByName(testName);
} else
addTestByName(testName);
for (const name of benchmarkNames) {
const groupSymbol = Symbol.for(name);
if (benchmarksByGroup.has(groupSymbol))
enableBenchmarksByGroup(groupSymbol)
else
enableBenchmarksByName(name);
}
}
@ -2355,53 +2333,53 @@ if (typeof testList !== "undefined") {
processTestList(customTestList);
} else {
if (runARES)
addTestsByGroup(ARESGroup);
enableBenchmarksByGroup(ARESGroup);
if (runCDJS)
addTestsByGroup(CDJSGroup);
enableBenchmarksByGroup(CDJSGroup);
if (runCodeLoad)
addTestsByGroup(CodeLoadGroup);
enableBenchmarksByGroup(CodeLoadGroup);
if (runOctane)
addTestsByGroup(OctaneGroup);
enableBenchmarksByGroup(OctaneGroup);
if (runRexBench)
addTestsByGroup(RexBenchGroup);
enableBenchmarksByGroup(RexBenchGroup);
if (runSeaMonster)
addTestsByGroup(SeaMonsterGroup);
enableBenchmarksByGroup(SeaMonsterGroup);
if (runSimple)
addTestsByGroup(SimpleGroup);
enableBenchmarksByGroup(SimpleGroup);
if (runSunSpider)
addTestsByGroup(SunSpiderGroup);
enableBenchmarksByGroup(SunSpiderGroup);
if (runBigIntNoble)
addTestsByGroup(BigIntNobleGroup);
enableBenchmarksByGroup(BigIntNobleGroup);
if (runBigIntMisc)
addTestsByGroup(BigIntMiscGroup);
enableBenchmarksByGroup(BigIntMiscGroup);
if (runProxy)
addTestsByGroup(ProxyGroup);
enableBenchmarksByGroup(ProxyGroup);
if (runClassFields)
addTestsByGroup(ClassFieldsGroup);
enableBenchmarksByGroup(ClassFieldsGroup);
if (runGenerators)
addTestsByGroup(GeneratorsGroup);
enableBenchmarksByGroup(GeneratorsGroup);
if (runWasm)
addTestsByGroup(WasmGroup);
enableBenchmarksByGroup(WasmGroup);
if (runWorkerTests)
addTestsByGroup(WorkerTestsGroup);
enableBenchmarksByGroup(WorkerTestsGroup);
if (runWSL)
addTestsByGroup(WSLGroup);
enableBenchmarksByGroup(WSLGroup);
if (runWTB)
addTestsByGroup(WTBGroup);
enableBenchmarksByGroup(WTBGroup);
}