Skip to content

Instantly share code, notes, and snippets.

@mafredri
Created July 22, 2015 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mafredri/7625b223db6c2a1200f4 to your computer and use it in GitHub Desktop.
Save mafredri/7625b223db6c2a1200f4 to your computer and use it in GitHub Desktop.
Benchmarking modifications to prompt pure
#!/usr/bin/env zsh
BRANCH=$1
BRANCHES=(master pure-nitro pure-nitro2)
BENCHDIR=benchmark
ROUNDS=100
if [[ ! -n $BRANCH ]]; then
[[ ! -d $BENCHDIR ]] && mkdir $BENCHDIR
for i in $BRANCHES; do
./pure_benchmark.zsh $i
done
local header="--header-out"
for i in $BENCHDIR/*.log; do
sort $i | datamash $header sum 1 max 1 min 1 mean 1 median 1
unset header
done
exit 0
fi
print "Testing: $BRANCH"
git checkout $BRANCH &>/dev/null
LOG="$BENCHDIR/${BRANCH}.log"
. ./async.zsh
async
. ./pure.zsh
prompt_pure_setup
# disable async job, not relevant for the purpose of this test
unset async_job
async_job() { }
float -F time
print -n |> $LOG
for i in {1..$ROUNDS}; do
time=$EPOCHREALTIME
prompt_pure_precmd &>/dev/null
(( time = EPOCHREALTIME - time ))
print $time >> $LOG
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment