Skip to content

Commit

Permalink
Report geometric mean of averages.
Browse files Browse the repository at this point in the history
Before we used to compute the geometric mean of all samples as time and
then turn that into rate, which is confusing since it doesn't match the
intuition (and the definition) of geometric mean of rates.
  • Loading branch information
bmeurer committed Oct 18, 2017
1 parent eac1714 commit 9545102
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ suite.forEach(benchmark => {

suite.on("complete", event => {
if (suite.aborted) return;
const sample = [];
suite.forEach(benchmark => {
sample.push(...benchmark.stats.sample);
});
const hz = 1 / gmean(sample);
const hz = gmean(suite.map(benchmark => benchmark.hz));
displayResultMessage("geomean", `${hz.toFixed(2)}`, "highlighted-result");

const statusDiv = document.getElementById("status");
Expand Down
6 changes: 1 addition & 5 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ suite.on("cycle", event => {

suite.on("complete", event => {
if (suite.aborted) return;
const sample = [];
suite.forEach(benchmark => {
sample.push(...benchmark.stats.sample);
});
const hz = 1 / gmean(sample);
const hz = gmean(suite.map(benchmark => benchmark.hz));
console.log("--------------------------------------");
console.log(`Geometric mean: ${align(hz.toFixed(2), 5, "right")} runs/sec`);
});
Expand Down

0 comments on commit 9545102

Please sign in to comment.