Skip to content

Commit a26d33b

Browse files
authored
Compact display for non-default params (#191)
- Only print the key/values that are actually different from the default. - Change testIterationCountMap and testWorstCaseCountMap to a simple object - Remove "Disabling resource prefetching" warning as it's now obvious from the params-diff
1 parent c432b1a commit a26d33b

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

JetStreamDriver.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function displayCategoryScores() {
5959
}
6060

6161
function getIterationCount(plan) {
62-
if (JetStreamParams.testIterationCountMap.has(plan.name))
63-
return JetStreamParams.testIterationCountMap.get(plan.name);
62+
if (plan.name in JetStreamParams.testIterationCountMap)
63+
return JetStreamParams.testIterationCountMap[plan.name];
6464
if (JetStreamParams.testIterationCount)
6565
return JetStreamParams.testIterationCount;
6666
if (plan.iterations)
@@ -69,8 +69,8 @@ function getIterationCount(plan) {
6969
}
7070

7171
function getWorstCaseCount(plan) {
72-
if (JetStreamParams.testWorstCaseCountMap.has(plan.name))
73-
return JetStreamParams.testWorstCaseCountMap.get(plan.name);
72+
if (plan.name in JetStreamParams.testWorstCaseCountMap)
73+
return JetStreamParams.testWorstCaseCountMap[plan.name];
7474
if (JetStreamParams.testWorstCaseCount)
7575
return JetStreamParams.testWorstCaseCount;
7676
if (plan.worstCaseCount !== undefined)

cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ load("./params.js");
125125

126126
async function runJetStream() {
127127
if (!JetStreamParams.isDefault) {
128-
console.warn(`Using non standard params: ${JSON.stringify(JetStreamParams, null, 2)}`)
128+
const paramsDiff = JetStreamParams.nonDefaultParams;
129+
console.warn(`Using non standard params: ${JSON.stringify(paramsDiff, null, 2)}`)
129130
}
130131
try {
131132
await JetStream.initialize();

params.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
2727

28+
const defaultEmptyMap = Object.freeze({});
2829

2930
class Params {
3031
// Enable a detailed developer menu to change the current Params.
@@ -44,8 +45,11 @@ class Params {
4445
RAMification = false;
4546
dumpJSONResults = false;
4647
dumpTestList = false;
47-
testIterationCountMap = new Map();
48-
testWorstCaseCountMap = new Map();
48+
// Override iteration and worst-case counts per workload.
49+
// Example:
50+
// testIterationCountMap = { "acorn-wtb": 5 };
51+
testIterationCountMap = defaultEmptyMap;
52+
testWorstCaseCountMap = defaultEmptyMap;
4953

5054
customPreIterationCode = undefined;
5155
customPostIterationCode = undefined;
@@ -60,7 +64,7 @@ class Params {
6064
_copyFromSearchParams(sourceParams) {
6165
this.startAutomatically = this._parseBooleanParam(sourceParams, "startAutomatically");
6266
this.developerMode = this._parseBooleanParam(sourceParams, "developerMode");
63-
this.shouldReport = this._parseBooleanParam(sourceParams, "report");
67+
this.shouldReport = this._parseBooleanParam(sourceParams, "shouldReport");
6468
this.prefetchResources = this._parseBooleanParam(sourceParams, "prefetchResources");
6569
this.RAMification = this._parseBooleanParam(sourceParams, "RAMification");
6670
this.dumpJSONResults = this._parseBooleanParam(sourceParams, "dumpJSONResults");
@@ -138,6 +142,16 @@ class Params {
138142
get isDefault() {
139143
return this === DefaultJetStreamParams;
140144
}
145+
146+
get nonDefaultParams() {
147+
const diff = Object.create(null);
148+
for (const [key, value] of Object.entries(this)) {
149+
if (value !== DefaultJetStreamParams[key]) {
150+
diff[key] = value;
151+
}
152+
}
153+
return diff;
154+
}
141155
}
142156

143157
const DefaultJetStreamParams = new Params();

0 commit comments

Comments
 (0)