X-Git-Url: http://nitlanguage.org diff --git a/benchmarks/bench_engines.sh b/benchmarks/bench_engines.sh index 1fe51d0..abc65e3 100755 --- a/benchmarks/bench_engines.sh +++ b/benchmarks/bench_engines.sh @@ -17,6 +17,7 @@ # TODO: cleanup and libify the helper-parts +source ./bench_common.sh source ./bench_plot.sh ## CONFIGURATION OPTIONS ## @@ -35,76 +36,6 @@ function die() died=1 } -# Run a single command multiple time and store the execution times -# in the current $res file. -# -# $1: title of the command -# $2: long desription of the command -# rest: the command to execute -function bench_command() -{ - if [ "$dry_run" = "true" ]; then return; fi - local title="$1" - local desc="$2" - shift - shift - if test "$verbose" = true; then outputopts="/dev/stdout"; else outputopts="/dev/null"; fi - timeout="time.out" - echo "$title" > "$timeout" - echo "# $desc" >> "$timeout" - echo "\$ $@" >> "$timeout" - echo - echo "** [$title] $desc **" - echo " $ $@" - - # Execute the commands $count times - for i in `seq 1 "$count"`; do - /usr/bin/time -f "%U" -o "$timeout" -a "$@" > $outputopts 2>&1 || die "$1: failed" - echo -n "$i. " - tail -n 1 "$timeout" - done - - line=`compute_stats "$timeout"` - echo "$line ($res)" - echo $line >> "$res" -} - -# Run a simble command witout storing the execution time -# Used to display command on verbose and skip long executions when dry_run is given -# $@ command to execute -function run_command() -{ - if [ "$dry_run" = "true" ]; then return; fi - echo " $ $@" - "$@" || die "$@: failed" -} - -# Check if the test should be skiped according to its name -# $1: name of the test -# $2: description of the test -# $NOTSKIPED: arguments -function skip_test() -{ - if test -z "$NOTSKIPED"; then - echo "* $1" - return 0 - fi - if test "$NOTSKIPED" = "all"; then - : # Execute anyway - elif echo "$1" | egrep "$NOTSKIPED" >/dev/null 2>&1; then - : # Found one to execute - else - return 0 - fi - if test -n "$html"; then - echo >>"$html" "

$1

" - fi - echo "*" - echo "* $1 *****" - echo "*" - return 1 -} - # HELPER FOR NIT # # Run standards benchs on a compiler command @@ -176,8 +107,8 @@ fi ## COMPILE ENGINES -test -f ../src/nitc_3 || ../src/ncall.sh -O -test -f ./nitg || ../src/nitc_3 ../src/nitg.nit -O -v +# force to use the last nitg, not the bootstraped one +test -f ./nitg || ../bin/nitg ../src/nitg.nit -v ## EFFECTIVE BENCHS ## @@ -225,14 +156,15 @@ function bench_nitg-g_options() fi for opt in "$@"; do - prepare_res "$name$opt.dat" "$opt" "nitg-g with option $opt" - run_compiler "nitg-g$opt" ./nitg --global $opt + ot=${opt// /+} + prepare_res "$name$ot.dat" "$opt" "nitg-g with option $opt" + run_compiler "nitg-g$ot" ./nitg --global $opt done plot "$name.gnu" } -bench_nitg-g_options "hardening" --hardening -bench_nitg-g_options "nocheck" --no-check-covariance --no-check-initialization --no-check-assert --no-check-autocast --no-check-other +bench_nitg-g_options "slower" --hardening +bench_nitg-g_options "nocheck" --no-check-covariance --no-check-attr-isset --no-check-assert --no-check-autocast --no-check-other function bench_nitg-s_options() { @@ -251,16 +183,16 @@ function bench_nitg-s_options() fi for opt in "$@"; do - prepare_res "$name$opt.dat" "$opt" "nitg-s with option $opt" - run_compiler "nitg-s$opt" ./nitg --separate $opt + ot=${opt// /+} + prepare_res "$name-$ot.dat" "$opt" "nitg-s with option $opt" + run_compiler "nitg-s$ot" ./nitg --separate $opt done plot "$name.gnu" } -bench_nitg-s_options "slower" --hardening --no-inline-intern --no-union-attribute --no-shortcut-equal --no-shortcut-range -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" NOALL --bm-typing --phand-typing +bench_nitg-s_options "slower" --hardening --no-inline-intern --no-union-attribute --no-shortcut-equal --no-shortcut-range "--no-gcc-directive likely" "--no-gcc-directive noreturn" +bench_nitg-s_options "nocheck" --no-check-covariance --no-check-attr-isset --no-check-assert --no-check-autocast --no-check-other +bench_nitg-s_options "faster" --inline-coloring-numbers --inline-some-methods --direct-call-monomorph "--inline-some-methods --direct-call-monomorph" function bench_nitg-e_options() { @@ -279,16 +211,16 @@ function bench_nitg-e_options() fi for opt in "$@"; do - prepare_res "$name$opt.dat" "$opt" "nitg-e with option $opt" - run_compiler "nitg-e$opt" ./nitg --erasure $opt + ot=${opt// /+} + prepare_res "$name$ot.dat" "$opt" "nitg-e with option $opt" + run_compiler "nitg-e$ot" ./nitg --erasure $opt done plot "$name.gnu" } bench_nitg-e_options "slower" --hardening --no-inline-intern --no-union-attribute --no-shortcut-equal --no-shortcut-range -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 "nocheck" --no-check-covariance --no-check-attr-isset --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" NOALL --bm-typing # --phand-typing function bench_engines() { @@ -346,19 +278,31 @@ function bench_policy() } bench_policy +function bench_nullables() +{ + name="$FUNCNAME" + skip_test "$name" && return + prepare_res "$name-nitc.dat" "nitc" "nitc no options" + run_compiler "nitc" ./nitg --separate + prepare_res "$name-nitc-ni.dat" "nitc-ni" "nitc --no-check-attr-isset" + run_compiler "nitc" ./nitg --separate --no-check-attr-isset + prepare_res "$name-nitc-nu.dat" "nitc-nu" "nitc --no-union-attribute" + run_compiler "nitc" ./nitg --separate --no-union-attribute + prepare_res "$name-nitc-nu-ni.dat" "nitc-nu-ni" "nitc --no-union-attribute --no-check-attr-isset" + run_compiler "nitc" ./nitg --separate --no-union-attribute --no-check-attr-isset + plot "$name.gnu" +} +bench_nullables + function bench_compilation_time { name="$FUNCNAME" skip_test "$name" && return - prepare_res "$name-nitc.dat" "nitc" "nitc" - for i in ../examples/hello_world.nit ../src/test_parser.nit ../src/nitg.nit; do - bench_command `basename "$i" .nit` "" ../src/nitc_3 -O "$i" --no-cc - done - prepare_res "$name-nitg.dat" "nitg-g" "nitg --global" + prepare_res "$name-nitg-g.dat" "nitg-g" "nitg --global" for i in ../examples/hello_world.nit ../src/test_parser.nit ../src/nitg.nit; do bench_command `basename "$i" .nit` "" ./nitg --global "$i" --no-cc done - prepare_res "$name-nitg-e.dat" "nitg-e" "nitg --separate" + prepare_res "$name-nitg-s.dat" "nitg-s" "nitg --separate" for i in ../examples/hello_world.nit ../src/test_parser.nit ../src/nitg.nit; do bench_command `basename "$i" .nit` "" ./nitg --separate "$i" --no-cc done