~kris/dots

srice

ref: 2582f0c4173a4ad6a31e0cb759473c893cdc4e93 srice/.local/bin/benchit -rwxr-xr-x 480 bytes
2582f0c4 — Kris Yotam sb-cpu: portable temp source (Intel Core 0, AMD Tdie/Tctl, Asahi NVMe Composite fallback) 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# benchit -- quick benchmark wrapper around hyperfine
# Usage: benchit <command>
#        benchit -n 100 <command>
#        benchit -c <cmd1> <cmd2>  (compare two commands)

if [ "$1" = "-c" ]; then
    shift
    cmd1="$1"; cmd2="$2"
    [ -z "$cmd2" ] && { echo "Usage: benchit -c <cmd1> <cmd2>"; exit 1; }
    hyperfine --warmup 3 "$cmd1" "$cmd2"
elif [ "$1" = "-n" ]; then
    shift; n="$1"; shift
    hyperfine --runs "$n" "$*"
else
    hyperfine --warmup 3 "$*"
fi