aboutsummaryrefslogtreecommitdiff
path: root/bench/summarize.jq
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-04-07 18:24:03 -0700
committerJade Lovelace <lix@jade.fyi>2024-04-08 19:50:24 -0700
commitf4fc2b5d10c5bfab6d037e7c9c944d2277f70c58 (patch)
tree2eb3e6548771e595baa7d396a5a4672fadb4923a /bench/summarize.jq
parent1e74bffd5c37bed52ef8547ffa2b4e7f895e4e2a (diff)
Add benchmarking scripts
These scripts were originally written by horrors, and have since been hacked up a lot by jade. We are putting them up as a CL since it is better to have checked in benchmarking scripts than to not have benchmarking scripts. cc: https://git.lix.systems/lix-project/lix/issues/23 Co-authored-by: eldritch horrors <pennae@lix.systems> Change-Id: I95c2f9d24753ac468944c5781deec9508fd5cb8c
Diffstat (limited to 'bench/summarize.jq')
-rwxr-xr-xbench/summarize.jq22
1 files changed, 22 insertions, 0 deletions
diff --git a/bench/summarize.jq b/bench/summarize.jq
new file mode 100755
index 000000000..5d1449108
--- /dev/null
+++ b/bench/summarize.jq
@@ -0,0 +1,22 @@
+#!/usr/bin/env -S jq -Mrf
+
+def round3:
+ . * 1000 | round | . / 1000
+ ;
+
+def stats($first):
+ [
+ " mean: \(.mean | round3)s ± \(.stddev | round3)s",
+ " user: \(.user | round3)s | system: \(.system | round3)s",
+ " median: \(.median | round3)s",
+ " range: \(.min | round3)s ... \(.max | round3)s",
+ " relative: \(.mean / $first.mean | round3)"
+ ]
+ | join("\n")
+ ;
+
+def fmt($first):
+ "\(.command)\n" + (. | stats($first))
+ ;
+
+[.results | .[0] as $first | .[] | fmt($first)] | join("\n\n") | (. + "\n\n---\n")