diff options
author | Raashid Anwar <raashid12anwar@gmail.com> | 2023-12-18 04:27:14 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 22:57:14 +0000 |
commit | 9ede8d7b69c1d2859bb03e5bdffd7407042914ec (patch) | |
tree | 12776cfaab9387d2260cfe48d793a7010fd7c673 | |
parent | 4c2c053afeae3ba359ffc4b858877e69bae4c4dd (diff) |
fix(bench): added group banner to bench output. (#21551)
Added group banner to bench output.
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
-rw-r--r-- | cli/tests/integration/bench_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/testdata/bench/check_local_by_default.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/collect.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/collect2.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/explicit_start_and_end_low_precision.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/group_baseline.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/bench/ignore.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/ignore_permissions.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/interval.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/meta.out | 1 | ||||
-rw-r--r-- | cli/tests/testdata/bench/multifile_summary.out | 11 | ||||
-rw-r--r-- | cli/tests/testdata/bench/multiple_group.ts | 15 | ||||
-rw-r--r-- | cli/tools/bench/mitata.rs | 2 | ||||
-rw-r--r-- | cli/tools/bench/reporters.rs | 11 |
14 files changed, 38 insertions, 13 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 6e61cd7f2..1d882121f 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 4fc2f2a68..bf07bcc44 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 016adaf9d..03c75922b 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 112abb126..00b8bfc0d 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 771164bac..6dc66cfcc 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 cafded7da..5de0ac1fe 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 6ac7f2e2b..0693a7fc8 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 389590a16..1c8e93535 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 c6110f0a5..389b89162 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 beba58df7..8c9aa9123 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 d4e1157ec..37aebe187 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 000000000..69e73a7f2 --- /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 7ddea6f82..57d1fc1df 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 a3e3f85d1..f33dbc94b 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(); |