echo " -v: verbose mode"
echo " -n count: number of execution for each bar (default: $count)"
echo " -h: this help"
+ echo " --head-only: do not try to pass benchmarks on variants"
+ echo " --maxlen min_maxln inc_maxln max_maxln: start bench with different values of threshold between ropes and flats"
echo ""
echo "Benches : "
echo " index: indexed access benchmark"
usage
exit
fi
- echo "Generating executable index_bench for variant $variant"
- ../../bin/nitc --global index_bench.nit
+ echo "Generating executable index_bench for variant $variant";
+
+ ../../bin/nitc --global index_bench.nit -D maxlen=$curr_maxln
bench_indexed_variant "string" $1 $2 $3 $4
bench_indexed_variant "buffer" $1 $2 $3 $4
# $5: strlen max
function bench_indexed_variant()
{
- tmp="${variant}_$1"
- prepare_res index_$tmp.out $tmp $tmp
+ tmp="${variant}_${1}_${curr_maxln}.out"
+ prepare_res_lines index_$tmp $tmp $tmp
for i in `seq "$3" "$4" "$5"`; do
bench_command $i index_$tmp$i ./index_bench -m $1 --loops $2 --strlen $i
done
fi
echo "Generating executable chain_concat for variant $variant"
- ../../bin/nitc --global chain_concat.nit
+ ../../bin/nitc chain_concat.nit -D maxlen=$curr_maxlen
bench_concat_variant "string" $1 $2 $3 $4 $5
bench_concat_variant "buffer" $1 $2 $3 $4 $5
function bench_concat_variant()
{
tmp="${variant}_$1"
- prepare_res out/concat/concat_$tmp.out $tmp $tmp
+ prepare_res_lines out/concat/concat_$tmp.out $tmp $tmp
for i in `seq "$4" "$5" "$6"`; do
bench_command $i $tmp$i ./chain_concat -m $1 --loops $2 --strlen $3 --ccts $i
done
exit
fi
echo "Generating executable iteration_bench for variant $variant"
- ../../bin/nitc --global iteration_bench.nit
+ ../../bin/nitc --global iteration_bench.nit -D maxlen=$curr_maxlen
bench_iterate_variant "iterator" "string" $1 $2 $3 $4
bench_iterate_variant "index" "string" $1 $2 $3 $4
function bench_iterate_variant()
{
tmp="${variant}_$1_$2"
- prepare_res out/iteration/iteration_$tmp.out $tmp $tmp
+ prepare_res_lines out/iteration/iteration_$tmp.out $tmp $tmp
for i in `seq "$4" "$5" "$6"`; do
bench_command $i $tmp$i ./iteration_bench -m $2 --iter-mode $1 --loops $3 --strlen $i
done
exit
fi
echo "Generating executable substr_bench for variant $variant"
- ../../bin/nitc --global substr_bench.nit
+ ../../bin/nitc --global substr_bench.nit -D maxlen=$curr_maxlen
bench_substring_variant "string" $1 $2 $3 $4
bench_substring_variant "buffer" $1 $2 $3 $4
function bench_substring_variant()
{
tmp="${variant}_$1"
- prepare_res out/substring/substring_$tmp.out $tmp $tmp
+ prepare_res_lines out/substring/substring_$tmp.out $tmp $tmp
for i in `seq "$3" "$4" "$5"`; do
bench_command $i $tmp$i ./substr_bench -m $1 --loops $2 --strlen $i
done
function bench_compiler()
{
- prepare_res out/compiler/compiler_$variant.out compiler_$variant compiler_$variant
+ prepare_res_lines out/compiler/compiler_$variant.out compiler_$variant compiler_$variant
echo "Pre-compiling nitc"
# Do it twice before bench to have stable times when generating C
../../bin/nitc ../../src/nitc.nit -o ../../bin/nitc
echo "nitc (2/2)"
- bench_command nitc nitc_$variant ../../bin/nitc ../../src/nitc.nit
+ bench_command nitc nitc_$variant ../../bin/nitc ../../src/nitc.nit -D maxlen=$curr_maxlen
rm nitc
}
function bench_basic()
{
- ../../bin/nitc ../../examples/hello_world.nit
+ ../../bin/nitc ../../examples/hello_world.nit -D maxlen=$curr_maxlen
./hello_world
rm hello_world
}
function main()
{
+ html="index.html"
+ head_only=false
+ bench_maxln=false
+ curr_maxln=64
+ echo >"$html" "<html><head></head><body>"
stop=false
while [ "$stop" = false ]; do
case "$1" in
+ --maxlen) bench_maxln=true; min_maxln=$2; inc_maxln=$3; max_maxln=$4; shift; shift; shift; shift;;
-v) verbose=true; shift;;
-h) usage; exit;;
-n) count="$2"; shift; shift;;
+ --head-only) head_only=true; shift;;
*) stop=true
esac
done
bench=$1
shift;
+ if [ "${bench_maxln}" = true ]; then
+ for i in `seq $min_maxln $inc_maxln $max_maxln`; do curr_maxln=$i; launch_benches "$@"; done;
+ else
+ launch_benches "$@";
+ fi
+
+ if [ "${need_plot}" = true ]; then
+ plot_lines out/$bench/$bench.gnu
+ fi
+
+ echo >> "$html" "</body></html>"
+}
+
+function launch_benches()
+{
head=`git rev-parse HEAD`
variant="HEAD"
need_plot=true
echo "---------------------------------------------------------"
bench_$bench "$@";
- for i in lib_variants/regular/*; do
- curr_rev=$i
- variant=`basename "$i" | cut -f 1 -d '.'`
- launch_bench "$@"
- done
-
- need_bootstrap=true
- for i in lib_variants/need_bootstrap/*; do
- curr_rev=$i
- variant=`basename "$i" | cut -f 1 -d '.'`
- launch_bench "$@"
- done
-
- if [ "${need_plot}" = true ]; then
- plot out/$bench/$bench.gnu
+ if [ ! $head_only ]; then
+ for i in lib_variants/regular/*; do
+ curr_rev=$i
+ variant=`basename "$i" | cut -f 1 -d '.'`
+ launch_bench "$@"
+ done
+
+ need_bootstrap=true
+ for i in lib_variants/need_bootstrap/*; do
+ curr_rev=$i
+ variant=`basename "$i" | cut -f 1 -d '.'`
+ launch_bench "$@"
+ done
fi
}