diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 6e61cd7f2f..1d882121f1 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -80,7 +80,7 @@ itest!(only { }); itest!(multifile_summary { - args: "bench bench/group_baseline.ts bench/pass.ts bench/group_baseline.ts", + args: "bench bench/group_baseline.ts bench/pass.ts bench/multiple_group.ts", exit_code: 0, output: "bench/multifile_summary.out", }); diff --git a/cli/tests/testdata/bench/check_local_by_default.out b/cli/tests/testdata/bench/check_local_by_default.out index 4fc2f2a68e..bf07bcc443 100644 --- a/cli/tests/testdata/bench/check_local_by_default.out +++ b/cli/tests/testdata/bench/check_local_by_default.out @@ -3,3 +3,4 @@ [WILDCARD]/bench/check_local_by_default.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/collect.out b/cli/tests/testdata/bench/collect.out index 016adaf9dc..03c75922b7 100644 --- a/cli/tests/testdata/bench/collect.out +++ b/cli/tests/testdata/bench/collect.out @@ -15,3 +15,4 @@ benchmark time (avg) iter/s (min … max) p75 [WILDCARD]/bench/collect/include/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/collect2.out b/cli/tests/testdata/bench/collect2.out index 112abb126e..00b8bfc0d3 100644 --- a/cli/tests/testdata/bench/collect2.out +++ b/cli/tests/testdata/bench/collect2.out @@ -10,3 +10,4 @@ benchmark time (avg) iter/s (min … max) p75 [WILDCARD]/bench/collect/include/bench.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/explicit_start_and_end_low_precision.out b/cli/tests/testdata/bench/explicit_start_and_end_low_precision.out index 771164bac3..6dc66cfcc3 100644 --- a/cli/tests/testdata/bench/explicit_start_and_end_low_precision.out +++ b/cli/tests/testdata/bench/explicit_start_and_end_low_precision.out @@ -7,3 +7,4 @@ benchmark time (avg) iter/s (min … max) noop with start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] Warning: start() and end() calls in "noop with start and end" are ignored because it averages less than 10µs per iteration. Remove them for better results. + diff --git a/cli/tests/testdata/bench/group_baseline.out b/cli/tests/testdata/bench/group_baseline.out index cafded7da9..5de0ac1fe5 100644 --- a/cli/tests/testdata/bench/group_baseline.out +++ b/cli/tests/testdata/bench/group_baseline.out @@ -8,6 +8,7 @@ summary noo[WILDCARD] [WILDCARD]x [WILDCARD] than noo[WILDCARD] +group url noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] @@ -16,3 +17,4 @@ summary parse url 2x [WILDCARD]x slower than noop3 [WILDCARD]x faster than parse url 200x + diff --git a/cli/tests/testdata/bench/ignore.out b/cli/tests/testdata/bench/ignore.out index 6ac7f2e2b7..0693a7fc8d 100644 --- a/cli/tests/testdata/bench/ignore.out +++ b/cli/tests/testdata/bench/ignore.out @@ -5,3 +5,4 @@ runtime: deno [WILDCARD] ([WILDCARD]) [WILDCARD]/bench/ignore.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/ignore_permissions.out b/cli/tests/testdata/bench/ignore_permissions.out index 389590a160..1c8e93535f 100644 --- a/cli/tests/testdata/bench/ignore_permissions.out +++ b/cli/tests/testdata/bench/ignore_permissions.out @@ -5,3 +5,4 @@ runtime: deno [WILDCARD] ([WILDCARD]) [WILDCARD]/bench/ignore_permissions.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/interval.out b/cli/tests/testdata/bench/interval.out index c6110f0a5c..389b891629 100644 --- a/cli/tests/testdata/bench/interval.out +++ b/cli/tests/testdata/bench/interval.out @@ -5,3 +5,4 @@ runtime: deno [WILDCARD] ([WILDCARD]) [WILDCARD]/bench/interval.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/meta.out b/cli/tests/testdata/bench/meta.out index beba58df79..8c9aa91236 100644 --- a/cli/tests/testdata/bench/meta.out +++ b/cli/tests/testdata/bench/meta.out @@ -7,3 +7,4 @@ runtime: deno [WILDCARD] ([WILDCARD]) [WILDCARD]/bench/meta.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- + diff --git a/cli/tests/testdata/bench/multifile_summary.out b/cli/tests/testdata/bench/multifile_summary.out index d4e1157ecc..37aebe1875 100644 --- a/cli/tests/testdata/bench/multifile_summary.out +++ b/cli/tests/testdata/bench/multifile_summary.out @@ -1,6 +1,6 @@ Check [WILDCARD]/bench/group_baseline.ts Check [WILDCARD]/bench/pass.ts -Check [WILDCARD]/bench/group_baseline.ts +Check [WILDCARD]/bench/multiple_group.ts cpu: [WILDCARD] runtime: deno [WILDCARD] ([WILDCARD]) @@ -14,6 +14,7 @@ summary noo[WILDCARD] [WILDCARD]x [WILDCARD] than noo[WILDCARD] +group url noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] @@ -23,6 +24,7 @@ summary [WILDCARD]x slower than noop3 [WILDCARD]x faster than parse url 200x + [WILDCARD]/bench/pass.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 --------------------------------------------------------------- ----------------------------- @@ -37,9 +39,12 @@ bench7 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] -[WILDCARD]/bench/group_baseline.ts + +[WILDCARD]/bench/multiple_group.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 -------------------------------------------------------------------- ----------------------------- + +group noop noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] @@ -47,6 +52,7 @@ summary noo[WILDCARD] [WILDCARD]x [WILDCARD] than noo[WILDCARD] +group url noop3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 2x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] parse url 200x [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] @@ -55,3 +61,4 @@ summary parse url 2x [WILDCARD]x slower than noop3 [WILDCARD]x faster than parse url 200x + diff --git a/cli/tests/testdata/bench/multiple_group.ts b/cli/tests/testdata/bench/multiple_group.ts new file mode 100644 index 0000000000..69e73a7f25 --- /dev/null +++ b/cli/tests/testdata/bench/multiple_group.ts @@ -0,0 +1,15 @@ +Deno.bench("noop", { group: "noop" }, () => {}); +Deno.bench("noop2", { group: "noop", baseline: true }, () => {}); + +Deno.bench("noop3", { group: "url" }, () => {}); + +Deno.bench("parse url 2x", { group: "url", baseline: true }, () => { + new URL("https://deno.land/std/http/server.ts"); + new URL("https://deno.land/std/http/server.ts"); +}); + +Deno.bench("parse url 200x", { group: "url" }, () => { + for (let i = 0; i < 200; i++) { + new URL("https://deno.land/std/http/server.ts"); + } +}); diff --git a/cli/tools/bench/mitata.rs b/cli/tools/bench/mitata.rs index 7ddea6f823..57d1fc1dff 100644 --- a/cli/tools/bench/mitata.rs +++ b/cli/tools/bench/mitata.rs @@ -395,7 +395,7 @@ pub mod reporter { } else { s.push_str(&format!( "{}\n {}", - colors::bold("summary"), + colors::gray("summary"), colors::cyan_bold(&baseline.name) )); diff --git a/cli/tools/bench/reporters.rs b/cli/tools/bench/reporters.rs index a3e3f85d1e..f33dbc94bf 100644 --- a/cli/tools/bench/reporters.rs +++ b/cli/tools/bench/reporters.rs @@ -178,13 +178,6 @@ impl BenchReporter for ConsoleReporter { } Some(group) => { - if self.group.is_none() - && self.has_ungrouped - && self.group_measurements.is_empty() - { - println!(); - } - if self.group.is_none() || group != self.group.as_ref().unwrap() { self.report_group_summary(); } @@ -192,7 +185,7 @@ impl BenchReporter for ConsoleReporter { if (self.group.is_none() && self.has_ungrouped) || (self.group.is_some() && self.group_measurements.is_empty()) { - println!(); + println!("{} {}", colors::gray("group"), colors::green(group)); } self.group = Some(group.clone()); @@ -212,7 +205,6 @@ impl BenchReporter for ConsoleReporter { } let options = self.options.as_ref().unwrap(); - match result { BenchResult::Ok(stats) => { let mut desc = desc.clone(); @@ -296,6 +288,7 @@ impl BenchReporter for ConsoleReporter { ) ); } + println!(); self.baseline = false; self.group_measurements.clear();