benchs: add nitg-s to benchs
[nit.git] / src / run_bench.sh
index 369cdcf..c4ebb6a 100755 (executable)
@@ -27,8 +27,8 @@ count=2
 
 function die()
 {
-       echo >&2 "DIE: $*"
-       exit 1
+       echo >&2 "error: $*"
+       died=1
 }
 
 # Run a single command multiple time and store the execution times
@@ -72,7 +72,7 @@ function run_command()
 {
        if [ "$dry_run" = "true" ]; then return; fi
        echo " $ $@"
-       "$@"
+       "$@" || die "$@: failed"
 }
 
 # perl function to compute min/max/avg.
@@ -294,11 +294,18 @@ bench_steps
 # $#: 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
@@ -306,15 +313,49 @@ function bench_nitg_options()
 
        plot "$name.gnu"
 }
-bench_nitg_options --hardening --no-check-covariance --no-check-initialization --no-check-assert --no-check-other
+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-s_options()
+{
+       tag=$1
+       shift
+       name="$FUNCNAME-$tag"
+       skip_test "$name" && return
+       prepare_res "$name.dat" "no options" "nitg-s without options"
+       run_compiler "nitg-s" ./nitg --separate
+
+       if test -n "$2"; then
+               prepare_res "$name-all.dat" "all" "nitg-s with all options $@"
+               run_compiler "nitg-s-$tag" ./nitg --separate $@
+       fi
+
+       for opt in "$@"; do
+               prepare_res "$name$opt.dat" "$opt" "nitg-s with option $opt"
+               run_compiler "nitg-s$opt" ./nitg --separate $opt
+       done
+
+       plot "$name.gnu"
+}
+bench_nitg-s_options "slower" --hardening --no-inline-intern --generic-resolution-tree
+bench_nitg-s_options "nocheck" --no-check-covariance --no-check-initialization --no-check-assert --no-check-autocast --no-check-other
+bench_nitg-s_options "faster" --inline-coloring-numbers
+bench_nitg-s_options "typing" --bm-typing --phmod-typing --phand-typing
 
 function bench_nitg-e_options()
 {
-       name="$FUNCNAME"
+       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
@@ -322,7 +363,10 @@ function bench_nitg-e_options()
 
        plot "$name.gnu"
 }
-bench_nitg-e_options --hardening --no-inline-intern --no-check-covariance --no-check-initialization --no-check-assert --no-check-other
+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()
 {
@@ -361,6 +405,8 @@ function bench_engines()
        run_compiler "nitc-g" ./nitc_3 -O --global
        prepare_res "$name-nitg.dat" "nitg" "nitg"
        run_compiler "nitg" ./nitg
+       prepare_res "$name-nitg-s.dat" "nitg-s" "nitg with --separate"
+       run_compiler "nitg-s" ./nitg --separate
        prepare_res "$name-nitg-e.dat" "nitg-e" "nitg with --erasure"
        run_compiler "nitg-e" ./nitg --erasure
        plot "$name.gnu"
@@ -386,3 +432,9 @@ function bench_compilation_time
        plot "$name.gnu"
 }
 bench_compilation_time
+
+if test -n "$died"; then
+       echo "Some commands failed"
+       exit 1
+fi
+exit 0