Skip to content

Commit 814e88e

Browse files
authored
feat: Narrow the bar display by another couple of characters by using ANSI line drawing. (#134)
test 1 ▏█████████████████████████▕ 125,555,696 ops/sec | 11 samples By using a left and right justified equivalent of "|" there's enough space to distinguish the bar from the end braces. These still look reasonable pasted into Github issue comments (which was the problem with one of my earlier attempts to make the bar display narrower). Since the important info in the chart output is at the right end of the line, this is what will probably be the last in my edits to try to shift the punchline of the output as far left as is possible.
1 parent 35eb144 commit 814e88e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/reporter/chart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function drawBar(
6464

6565
const displayedSamples = `${styleText(["yellow"], samples.toString().padStart(2))} samples`;
6666

67-
return `${label} | ${bar} | ${displayedValue} ${displayedMetric} | ${displayedSamples} ${comment}\n`;
67+
return `${label} ${bar} ${displayedValue} ${displayedMetric} | ${displayedSamples} ${comment}\n`;
6868
}
6969

7070
const formatter = Intl.NumberFormat(undefined, {

test/reporter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe("chartReport", () => {
113113
});
114114

115115
it("should pad out benchmark names", () => {
116-
assert.ok(output.includes("oong | "));
116+
assert.ok(output.includes("oong ▏█"));
117117
assert.ok(output.includes("multiple replaces".padEnd(51)));
118118
});
119119
});
@@ -534,7 +534,7 @@ describe("baseline comparisons", async (t) => {
534534

535535
it("can set a specific column width", () => {
536536
const summary = output.split("Summary (vs. baseline):")[1];
537-
assert.ok(summary.includes("baseline-test |"));
537+
assert.ok(summary.includes("baseline-test "));
538538
});
539539
});
540540
});

0 commit comments

Comments
 (0)