1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-18 03:44:05 -05:00

feat(bench): print iter/s in the report (#19994)

This commit adds "iter/s" column to the console report
generated by "deno bench" subcommand.
This commit is contained in:
Bartek Iwańczuk 2023-08-02 01:55:23 +02:00 committed by GitHub
parent fec34d8069
commit 36ae37604a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 142 additions and 70 deletions

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/allow_all.ts [WILDCARD]/bench/allow_all.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
---------------------------------------------------- ----------------------------- ------------------------------------------------------------------ -----------------------------
read false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] read false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
read true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] read true [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
write false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] write false [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/allow_none.ts [WILDCARD]/bench/allow_none.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
read error: PermissionDenied: Can't escalate parent thread permissions read error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD] [WILDCARD]
write error: PermissionDenied: Can't escalate parent thread permissions write error: PermissionDenied: Can't escalate parent thread permissions

View file

@ -2,6 +2,6 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] runtime: deno [WILDCARD]
[WILDCARD]/before_unload_prevent_default.ts [WILDCARD]/before_unload_prevent_default.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,6 +3,6 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/bench_formatting.ts [WILDCARD]/bench/bench_formatting.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
[WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] [WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -1,5 +1,5 @@
[WILDCARD] [WILDCARD]
[WILDCARD]/bench/check_local_by_default.ts [WILDCARD]/bench/check_local_by_default.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/clear_timeout.ts [WILDCARD]/bench/clear_timeout.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench3 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -5,13 +5,13 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/collect/bench.ts [WILDCARD]/bench/collect/bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
[WILDCARD]/bench/collect/include/2_bench.ts [WILDCARD]/bench/collect/include/2_bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
[WILDCARD]/bench/collect/include/bench.ts [WILDCARD]/bench/collect/include/bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -4,9 +4,9 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/collect/bench.ts [WILDCARD]/bench/collect/bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
[WILDCARD]/bench/collect/include/bench.ts [WILDCARD]/bench/collect/include/bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/exit_sanitizer.ts [WILDCARD]/bench/exit_sanitizer.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
exit(0) error: AssertionError: Bench attempted to exit with exit code: 0 exit(0) error: AssertionError: Bench attempted to exit with exit code: 0
[WILDCARD] [WILDCARD]
exit(1) error: AssertionError: Bench attempted to exit with exit code: 1 exit(1) error: AssertionError: Bench attempted to exit with exit code: 1

View file

@ -2,8 +2,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/explicit_start_and_end.ts [WILDCARD]/explicit_start_and_end.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------- ----------------------------- ------------------------------------------------------------------- -----------------------------
start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
start only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] start only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
end only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] end only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/fail.ts [WILDCARD]/bench/fail.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench0 error: Error bench0 error: Error
[WILDCARD] [WILDCARD]
bench1 error: Error bench1 error: Error

View file

@ -3,6 +3,6 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/file_protocol.ts [WILDCARD]/bench/file_protocol.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -5,16 +5,16 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/filter/a_bench.ts [WILDCARD]/bench/filter/a_bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
[WILDCARD]/bench/filter/b_bench.ts [WILDCARD]/bench/filter/b_bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
[WILDCARD]/bench/filter/c_bench.ts [WILDCARD]/bench/filter/c_bench.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] foo [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/finally_timeout.ts [WILDCARD]/bench/finally_timeout.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
error error: Error: fail error error: Error: fail
[WILDCARD] [WILDCARD]
success [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] success [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -1,6 +1,6 @@
[WILDCARD]/bench/group_baseline.ts [WILDCARD]/bench/group_baseline.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------------ ----------------------------- -------------------------------------------------------------------- -----------------------------
noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,5 +3,5 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/ignore.ts [WILDCARD]/bench/ignore.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -3,5 +3,5 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/ignore_permissions.ts [WILDCARD]/bench/ignore_permissions.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -3,5 +3,5 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/interval.ts [WILDCARD]/bench/interval.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -3,6 +3,6 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/load_unload.ts [WILDCARD]/bench/load_unload.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -5,5 +5,5 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/meta.ts [WILDCARD]/bench/meta.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------

View file

@ -5,8 +5,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/group_baseline.ts [WILDCARD]/bench/group_baseline.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------------ ----------------------------- -------------------------------------------------------------------- -----------------------------
noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
@ -24,8 +24,8 @@ summary
[WILDCARD]x faster than parse url 200x [WILDCARD]x faster than parse url 200x
[WILDCARD]/bench/pass.ts [WILDCARD]/bench/pass.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
@ -38,8 +38,8 @@ bench8 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD
bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench9 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
[WILDCARD]/bench/group_baseline.ts [WILDCARD]/bench/group_baseline.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------------ ----------------------------- -------------------------------------------------------------------- -----------------------------
noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] noop2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -2,8 +2,8 @@
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/no_prompt_by_default.ts [WILDCARD]/bench/no_prompt_by_default.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD] [WILDCARD]
error: Bench failed error: Bench failed

View file

@ -2,8 +2,8 @@
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/no_prompt_with_denied_perms.ts [WILDCARD]/bench/no_prompt_with_denied_perms.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag no prompt error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD] [WILDCARD]
error: Bench failed error: Bench failed

View file

@ -3,7 +3,7 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/only.ts [WILDCARD]/bench/only.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
error: Bench failed because the "only" option was used error: Bench failed because the "only" option was used

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/overloads.ts [WILDCARD]/bench/overloads.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -3,8 +3,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/pass.ts [WILDCARD]/bench/pass.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
------------------------------------------------- ----------------------------- --------------------------------------------------------------- -----------------------------
bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench0 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench1 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] bench2 [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -2,8 +2,8 @@ cpu: [WILDCARD]
runtime: deno [WILDCARD] ([WILDCARD]) runtime: deno [WILDCARD] ([WILDCARD])
[WILDCARD]/bench/quiet.ts [WILDCARD]/bench/quiet.ts
benchmark time (avg) (min … max) p75 p99 p995 benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------- ----------------------------- ------------------------------------------------------------------- -----------------------------
console.log [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] console.log [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
console.error [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] console.error [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]
console.info [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] console.info [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD]

View file

@ -7,5 +7,5 @@ runtime: [WILDCARD]
file:///[WILDCARD]/lib.bench.ts file:///[WILDCARD]/lib.bench.ts
[WILDCARD] [WILDCARD]
-------------------------------------------------- ----------------------------- ---------------------------------------------------------------- -----------------------------
should add [WILDCARD] should add [WILDCARD]

View file

@ -9,6 +9,72 @@
use crate::colors; use crate::colors;
use std::str::FromStr; use std::str::FromStr;
fn avg_to_iter_per_s(time: f64) -> String {
let iter_per_s = 1e9 / time;
let (decimals, fractional) = into_decimal_and_fractional_parts(iter_per_s);
human_readable_decimal_with_fractional(decimals, fractional)
}
/// Return a tuple representing decimal part of provided float, as well as its
/// first fractional digit.
fn into_decimal_and_fractional_parts(num: f64) -> (i64, i64) {
let decimal_part = num.floor();
let fractional_part = {
let decs = ((num - num.floor()) * 10.0).round();
if decs == 10.0 {
0
} else {
decs as i64
}
};
(decimal_part as i64, fractional_part)
}
fn human_readable_decimal_with_fractional(
decimal: i64,
fractional: i64,
) -> String {
// Sweet one-liner to separate integer by commas from:
// https://stackoverflow.com/a/67834588/21759102
let fmt_decimal = decimal
.to_string()
.as_bytes()
.rchunks(3)
.rev()
.map(std::str::from_utf8)
.collect::<Result<Vec<&str>, _>>()
.unwrap()
.join(",");
format!("{}.{}", fmt_decimal, fractional)
}
#[test]
fn test_into_decimal_and_fractional_parts() {
assert_eq!(into_decimal_and_fractional_parts(10.0), (10, 0));
assert_eq!(into_decimal_and_fractional_parts(10.1), (10, 1));
assert_eq!(into_decimal_and_fractional_parts(10.2), (10, 2));
assert_eq!(into_decimal_and_fractional_parts(10.3), (10, 3));
assert_eq!(into_decimal_and_fractional_parts(10.4), (10, 4));
assert_eq!(into_decimal_and_fractional_parts(10.5), (10, 5));
assert_eq!(into_decimal_and_fractional_parts(10.6), (10, 6));
assert_eq!(into_decimal_and_fractional_parts(10.7), (10, 7));
assert_eq!(into_decimal_and_fractional_parts(10.8), (10, 8));
assert_eq!(into_decimal_and_fractional_parts(10.9), (10, 9));
}
#[test]
fn test_avg_to_iter_per_s() {
assert_eq!(avg_to_iter_per_s(55.85), "17,905,102.0");
assert_eq!(avg_to_iter_per_s(64_870_000.0), "15.4");
assert_eq!(avg_to_iter_per_s(104_370_000.0), "9.6");
assert_eq!(avg_to_iter_per_s(6_400_000.0), "156.3");
assert_eq!(avg_to_iter_per_s(46_890_000.0), "21.3");
assert_eq!(avg_to_iter_per_s(100_000_000.0), "10.0");
assert_eq!(avg_to_iter_per_s(1_000_000_000.0), "1.0");
assert_eq!(avg_to_iter_per_s(5_920_000_000.0), "0.2");
}
pub fn fmt_duration(time: f64) -> String { pub fn fmt_duration(time: f64) -> String {
// SAFETY: this is safe since its just reformatting numbers // SAFETY: this is safe since its just reformatting numbers
unsafe { unsafe {
@ -194,7 +260,10 @@ pub mod reporter {
let mut s = String::new(); let mut s = String::new();
s.push_str(&"-".repeat( s.push_str(&"-".repeat(
options.size + 14 * options.avg as usize + 24 * options.min_max as usize, options.size
+ 14 * options.avg as usize
+ 14 * options.avg as usize
+ 24 * options.min_max as usize,
)); ));
if options.percentiles { if options.percentiles {
@ -239,6 +308,7 @@ pub mod reporter {
s.push_str(&format!("{:<size$}", "benchmark")); s.push_str(&format!("{:<size$}", "benchmark"));
if options.avg { if options.avg {
s.push_str(&format!("{:>14}", "time (avg)")); s.push_str(&format!("{:>14}", "time (avg)"));
s.push_str(&format!("{:>14}", "iter/s"));
} }
if options.min_max { if options.min_max {
s.push_str(&format!("{:>24}", "(min … max)")); s.push_str(&format!("{:>24}", "(min … max)"));
@ -266,6 +336,7 @@ pub mod reporter {
"{:>14}", "{:>14}",
format!("{}/iter", fmt_duration(stats.avg)) format!("{}/iter", fmt_duration(stats.avg))
)); ));
s.push_str(&format!("{:>14}", avg_to_iter_per_s(stats.avg)));
} }
if options.min_max { if options.min_max {
s.push_str(&format!( s.push_str(&format!(
@ -291,6 +362,7 @@ pub mod reporter {
"{:>30}", "{:>30}",
format!("{}/iter", colors::yellow(fmt_duration(stats.avg))) format!("{}/iter", colors::yellow(fmt_duration(stats.avg)))
)); ));
s.push_str(&format!("{:>14}", avg_to_iter_per_s(stats.avg)));
} }
if options.min_max { if options.min_max {
s.push_str(&format!( s.push_str(&format!(