deno
deno copied to clipboard
fix(bench): Make output table markdown compatible
This changes the format of the table outputted by deno bench to be markdown compatible.
deno coverage also outputs a table to the console, and there might very well be other commands too. However, both bench and coverage has their own logic for building up and outputting the table. So there is an opportunity to create a more generic (markdown) table builder/generator. However, as I'm not too familiar with the codebase, I did not do any generalization, and tried to keep the changes as minimal as possible to produce a markdown compatible table with the existing logic.
Example of current output (without this change):
$ deno bench
Check file:///Users/boyeln/Develepment/github/simple-parser/parser_bench.ts
CPU | Apple M1 Pro
Runtime | Deno 2.2.10 (aarch64-apple-darwin)
file:///Users/boyeln/Develepment/github/simple-parser/parser_bench.ts
benchmark time/iter (avg) iter/s (min … max) p75 p99 p995
----------- ----------------------------- --------------------- --------------------------
parse 22.6 µs 44,190 ( 21.2 µs … 121.9 µs) 22.6 µs 30.0 µs 51.8 µs
Example of new output (with this change):
$deno bench
Check file:///Users/boyeln/Develepment/github/simple-parser/parser_bench.ts
CPU | Apple M1 Pro
Runtime | Deno 2.3.3 (aarch64-apple-darwin)
file:///Users/boyeln/Develepment/github/simple-parser/parser_bench.ts
| benchmark | time/iter (avg) | iter/s | (min … max) | p75 | p99 | p995 |
| ----------- | --------------- | ------------- | --------------------- | -------- | -------- | -------- |
| parse | 22.6 µs | 44,300 | ( 20.9 µs … 117.3 µs) | 22.5 µs | 34.6 µs | 56.6 µs |
Related #29533 Closes #29466