]> Nishi Git Mirror - gwion.git/commitdiff
:wrench: Improve benchmark
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Thu, 23 Jul 2020 11:03:00 +0000 (13:03 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Thu, 23 Jul 2020 11:03:00 +0000 (13:03 +0200)
scripts/benchmark.sh

index 17b0a24b60e6bb0f39988e7812f7cf8f500f3672..f4f7884b40d5b1c268eaee800c47e30502f2b9b0 100644 (file)
@@ -3,6 +3,7 @@
 language=("gwion" "wren" "lua" "python" "chuck" "ruby")
 extension=("gw" "wren" "lua" "py" "ck" "rb")
 test_dir="benchmark"
+result_dir="$test_dir/results"
 plot_script="scripts/bench.plot"
 : "${repeats:=10}"
 
@@ -18,22 +19,19 @@ get_list() {
 }
 
 get_test() {
-  for (( i=0; i<=$(( ${#language[@]} -1 )); i++ ))
+  for i in $(seq 0 ${#language[@]})
   do
     if [ -f "$test_dir/$1.${extension[$i]}" ]
     then echo "${language[$i]} $(run "${language[$i]}" "${extension[$i]}" "$1")"
     fi
-  done > "benchmark/results/$1.dat"
+  done > "$result_dir/$1.dat"
 }
 
 plot() {
-  which perf
-  echo "$1"
-  cat "benchmark/results/$1.dat"
   gnuplot -e "bench='$1'" "$plot_script"
 }
 
-[ -d benchmark/results ] || mkdir benchmark/results
+[ -d "$result_dir/results" ] || mkdir "$result_dir"
 for bench in $(get_list)
 do
   get_test "$bench"