diff --git a/JetStreamDriver.js b/JetStreamDriver.js index ec89475f..9a406c0d 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -59,8 +59,8 @@ function displayCategoryScores() { } function getIterationCount(plan) { - if (JetStreamParams.testIterationCountMap.has(plan.name)) - return JetStreamParams.testIterationCountMap.get(plan.name); + if (plan.name in JetStreamParams.testIterationCountMap) + return JetStreamParams.testIterationCountMap[plan.name]; if (JetStreamParams.testIterationCount) return JetStreamParams.testIterationCount; if (plan.iterations) @@ -69,8 +69,8 @@ function getIterationCount(plan) { } function getWorstCaseCount(plan) { - if (JetStreamParams.testWorstCaseCountMap.has(plan.name)) - return JetStreamParams.testWorstCaseCountMap.get(plan.name); + if (plan.name in JetStreamParams.testWorstCaseCountMap) + return JetStreamParams.testWorstCaseCountMap[plan.name]; if (JetStreamParams.testWorstCaseCount) return JetStreamParams.testWorstCaseCount; if (plan.worstCaseCount !== undefined) diff --git a/cli.js b/cli.js index 6c0ccb63..7794358f 100644 --- a/cli.js +++ b/cli.js @@ -121,7 +121,8 @@ load("./params.js"); async function runJetStream() { if (!JetStreamParams.isDefault) { - console.warn(`Using non standard params: ${JSON.stringify(JetStreamParams, null, 2)}`) + const paramsDiff = JetStreamParams.nonDefaultParams; + console.warn(`Using non standard params: ${JSON.stringify(paramsDiff, null, 2)}`) } try { await JetStream.initialize(); diff --git a/params.js b/params.js index fa043864..1789c5e5 100644 --- a/params.js +++ b/params.js @@ -25,6 +25,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +const defaultEmptyMap = Object.freeze({}); class Params { // Enable a detailed developer menu to change the current Params. @@ -41,8 +42,11 @@ class Params { RAMification = false; dumpJSONResults = false; dumpTestList = false; - testIterationCountMap = new Map(); - testWorstCaseCountMap = new Map(); + // Override iteration and worst-case counts per workload. + // Example: + // testIterationCountMap = { "acorn-wtb": 5 }; + testIterationCountMap = defaultEmptyMap; + testWorstCaseCountMap = defaultEmptyMap; customPreIterationCode = undefined; customPostIterationCode = undefined; @@ -57,7 +61,7 @@ class Params { _copyFromSearchParams(sourceParams) { this.startAutomatically = this._parseBooleanParam(sourceParams, "startAutomatically"); this.developerMode = this._parseBooleanParam(sourceParams, "developerMode"); - this.shouldReport = this._parseBooleanParam(sourceParams, "report"); + this.shouldReport = this._parseBooleanParam(sourceParams, "shouldReport"); this.prefetchResources = this._parseBooleanParam(sourceParams, "prefetchResources"); this.RAMification = this._parseBooleanParam(sourceParams, "RAMification"); this.dumpJSONResults = this._parseBooleanParam(sourceParams, "dumpJSONResults"); @@ -134,6 +138,16 @@ class Params { get isDefault() { return this === DefaultJetStreamParams; } + + get nonDefaultParams() { + const diff = Object.create(null); + for (const [key, value] of Object.entries(this)) { + if (value !== DefaultJetStreamParams[key]) { + diff[key] = value; + } + } + return diff; + } } const DefaultJetStreamParams = new Params();