Skip to content

Commit 33dec4f

Browse files
authored
Deconfuse Geomean Metric and geomean aggregate value (#408)
The metric's "geomean" aggregate value can be easily confused with the top-level Geomean metric (issue #407). - Don't serialize "geomean" in the JSON data - Add descriptions to Score, Geomean, and Iteration metrics that are serialized in the JSON data - Make the detail view titles more descriptive
1 parent 3ae822b commit 33dec4f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ <h1>Score</h1>
7878
<h1 class="section-header">Detailed Results</h1>
7979
<div class="section-content all-metric-results">
8080
<div class="aggregated-metric-result">
81-
<h2>Geomean</h2>
81+
<h2>Aggregate Metric</h2>
8282
<div id="geomean-chart"></div>
83-
<h2>Tests</h2>
83+
<h2>Test Metrics Overview</h2>
8484
<div id="tests-chart"></div>
8585
</div>
8686
<br />
87-
<h2>Detailed Metrics</h2>
87+
<h2>Test Metrics Details</h2>
8888
<div id="metrics-results"></div>
8989
</div>
9090
<div class="buttons section-footer">

resources/benchmark-runner.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,9 @@ export class BenchmarkRunner {
574574
// Prepare all iteration metrics so they are listed at the end of
575575
// of the _metrics object, before "Total" and "Score".
576576
for (let i = 0; i < this._iterationCount; i++)
577-
iterationTotalMetric(i);
578-
getMetric("Geomean");
579-
getMetric("Score", "score");
577+
iterationTotalMetric(i).description = `Test totals for iteration ${i}`;
578+
getMetric("Geomean", "ms").description = "Geomean of test totals";
579+
getMetric("Score", "score").description = "Scaled inverse of the Geomean";
580580
}
581581

582582
const geomean = getMetric("Geomean");

resources/metric.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ export class Metric {
1010
throw new Error(`Invalid metric.name=${name}, expected string.`);
1111
this.name = name;
1212
this.unit = unit;
13+
this.description = "";
1314

1415
this.mean = 0.0;
15-
this.geomean = 0.0;
16+
// Make "geomean" non-enumerable so we don't serialize it with JSON.stringify
17+
// and avoid some confusion with the top-level Geomean metric.
18+
Object.defineProperty(this, "geomean", {
19+
writable: true,
20+
value: 0,
21+
});
1622
this.delta = 0.0;
1723
this.percentDelta = 0.0;
1824

@@ -21,7 +27,6 @@ export class Metric {
2127
this.max = 0.0;
2228

2329
this.values = [];
24-
this.children = [];
2530

2631
// Mark properties which refer to other Metric objects as
2732
// non-enumerable to avoid issue with JSON.stringify due to circular
@@ -31,6 +36,10 @@ export class Metric {
3136
writable: true,
3237
value: undefined,
3338
},
39+
children: {
40+
writable: true,
41+
value: [],
42+
},
3443
});
3544
}
3645

0 commit comments

Comments
 (0)