summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/bench_tests.rs6
-rw-r--r--cli/tests/testdata/bench/bench_formatting.out8
-rw-r--r--cli/tests/testdata/bench/bench_formatting.ts3
-rw-r--r--cli/tools/bench.rs6
4 files changed, 20 insertions, 3 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs
index 0fc268076..0ba297e63 100644
--- a/cli/tests/integration/bench_tests.rs
+++ b/cli/tests/integration/bench_tests.rs
@@ -43,6 +43,12 @@ itest!(fail {
output: "bench/fail.out",
});
+itest!(bench_formatting {
+ args: "bench bench/bench_formatting.ts",
+ exit_code: 0,
+ output: "bench/bench_formatting.out",
+});
+
itest!(collect {
args: "bench --ignore=bench/collect/ignore bench/collect",
exit_code: 0,
diff --git a/cli/tests/testdata/bench/bench_formatting.out b/cli/tests/testdata/bench/bench_formatting.out
new file mode 100644
index 000000000..9539e712f
--- /dev/null
+++ b/cli/tests/testdata/bench/bench_formatting.out
@@ -0,0 +1,8 @@
+Check [WILDCARD]/bench/bench_formatting.ts
+cpu: [WILDCARD]
+runtime: deno [WILDCARD] ([WILDCARD])
+
+[WILDCARD]/bench/bench_formatting.ts
+benchmark time (avg) (min … max) p75 p99 p995
+------------------------------------------------- -----------------------------
+[WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] \ No newline at end of file
diff --git a/cli/tests/testdata/bench/bench_formatting.ts b/cli/tests/testdata/bench/bench_formatting.ts
new file mode 100644
index 000000000..fdee15abb
--- /dev/null
+++ b/cli/tests/testdata/bench/bench_formatting.ts
@@ -0,0 +1,3 @@
+Deno.bench("Date.now", () => {
+ Date.now();
+});
diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs
index 1a5df92bf..6461e544f 100644
--- a/cli/tools/bench.rs
+++ b/cli/tools/bench.rs
@@ -1147,13 +1147,13 @@ mod mitata {
} else {
if options.avg {
s.push_str(&format!(
- "{:>23}",
+ "{:>30}",
format!("{}/iter", colors::yellow(fmt_duration(stats.avg)))
));
}
if options.min_max {
s.push_str(&format!(
- "{:>42}",
+ "{:>50}",
format!(
"({} … {})",
colors::cyan(fmt_duration(stats.min)),
@@ -1163,7 +1163,7 @@ mod mitata {
}
if options.percentiles {
s.push_str(&format!(
- " {:>18} {:>18} {:>18}",
+ " {:>22} {:>22} {:>22}",
colors::magenta(fmt_duration(stats.p75)),
colors::magenta(fmt_duration(stats.p99)),
colors::magenta(fmt_duration(stats.p995))