function die()
{
- echo >&2 "DIE: $*"
- exit 1
+ echo >&2 "error: $*"
+ died=1
}
# Run a single command multiple time and store the execution times
{
if [ "$dry_run" = "true" ]; then return; fi
echo " $ $@"
- "$@"
+ "$@" || die "$@: failed"
}
# perl function to compute min/max/avg.
# $#: options to compare
function bench_nitg_options()
{
- name="$FUNCNAME"
+ tag=$1
+ shift
+ name="$FUNCNAME-$tag"
skip_test "$name" && return
prepare_res "$name.dat" "no options" "nitg without options"
run_compiler "nitg" ./nitg
+ if test -n "$2"; then
+ prepare_res "$name-all.dat" "all" "nitg with all options $@"
+ run_compiler "nitg-$tag" ./nitg $@
+ fi
+
for opt in "$@"; do
prepare_res "$name$opt.dat" "$opt" "nitg with option $opt"
run_compiler "nitg$opt" ./nitg $opt
plot "$name.gnu"
}
-bench_nitg_options --hardening
+bench_nitg_options "hardening" --hardening
+bench_nitg_options "nocheck" --no-check-covariance --no-check-initialization --no-check-assert --no-check-autocast --no-check-other
+
+function bench_nitg-e_options()
+{
+ tag=$1
+ shift
+ name="$FUNCNAME-$tag"
+ skip_test "$name" && return
+ prepare_res "$name.dat" "no options" "nitg-e without options"
+ run_compiler "nitg-e" ./nitg --erasure
+
+ if test -n "$2"; then
+ prepare_res "$name-all.dat" "all" "nitg-e with all options $@"
+ run_compiler "nitg-e-$tag" ./nitg --erasure $@
+ fi
+
+ for opt in "$@"; do
+ prepare_res "$name$opt.dat" "$opt" "nitg-e with option $opt"
+ run_compiler "nitg-e$opt" ./nitg --erasure $opt
+ done
+
+ plot "$name.gnu"
+}
+bench_nitg-e_options "slower" --hardening --no-inline-intern
+bench_nitg-e_options "nocheck" --no-check-covariance --no-check-initialization --no-check-assert --no-check-autocast --no-check-other --no-check-erasure-cast
+bench_nitg-e_options "faster" --inline-coloring-numbers
+bench_nitg-e_options "typing" --bm-typing --phmod-typing --phand-typing
function bench_nitc_gc()
{
for i in ../examples/hello_world.nit test_parser.nit nitg.nit; do
bench_command `basename "$i" .nit` "" ./nitg "$i" --no-cc
done
- prepare_res "$name-nitg_g.dat" "nitg/g" "nitg/g"
+ prepare_res "$name-nitg-e.dat" "nitg-e" "nitg --erasure"
for i in ../examples/hello_world.nit test_parser.nit nitg.nit; do
- bench_command `basename "$i" .nit` "" ./nitg.bin "$i" --no-cc
+ bench_command `basename "$i" .nit` "" ./nitg --erasure "$i" --no-cc
done
plot "$name.gnu"
}
bench_compilation_time
+
+if test -n "$died"; then
+ echo "Some commands failed"
+ exit 1
+fi
+exit 0