Save the script below in a file, say comp-time.sh, in the root directory of plutus-semantics, and run chmod +x comp-time.sh.
#!/bin/bash
KPLC_CMD=".build/usr/bin/kplc run"
TIMEFORMAT="%E;%U;%S"
echo " ; kplc ; ; ; uplc ; ; ;"
echo "Test file ; Real ; User ; System ; Real ; User ; System ;"
echo " ; Elapsed real time ; CPU-seconds in user mode ; CPU-seconds in kernel mode ; Elapsed real time ; CPU-seconds in user mode ; CPU-seconds in kernel mode ;"
for i in $1/.uplc ;
do
OUT+="$(basename $i);"
OUT+=$( { time $KPLC_CMD $i 1> /dev/null ; } 2>&1 )
OUT=${OUT/==.uplc/}
OUT+=";"
OUT+=$( { time uplc evaluate -i $i 1> /dev/null ; } 2>&1 )
echo $OUT
OUT=""
done
2. In the root directory of `plutus-semantics`, run `./comp-time.sh <dir> > comparison.csv` where `<dir>` = `tests/textual/simple`, for instance, or any directory with `uplc` files, with `.uplc` extensions. The file `comparison.csv` is a semicolon (";") separated file where the columns are the test file name followed by real, user and system times for `kplc` and `uplc`.
Note: Some (expected) error messages are not yet filtered by the script.
uplc
must be in your path.comp-time.sh
, in the root directory ofplutus-semantics
, and runchmod +x comp-time.sh
.KPLC_CMD=".build/usr/bin/kplc run" TIMEFORMAT="%E;%U;%S" echo " ; kplc ; ; ; uplc ; ; ;" echo "Test file ; Real ; User ; System ; Real ; User ; System ;" echo " ; Elapsed real time ; CPU-seconds in user mode ; CPU-seconds in kernel mode ; Elapsed real time ; CPU-seconds in user mode ; CPU-seconds in kernel mode ;"
for i in $1/.uplc ; do OUT+="$(basename $i);" OUT+=$( { time $KPLC_CMD $i 1> /dev/null ; } 2>&1 ) OUT=${OUT/==.uplc/} OUT+=";" OUT+=$( { time uplc evaluate -i $i 1> /dev/null ; } 2>&1 ) echo $OUT OUT="" done