@@ -18,11 +18,13 @@ EXT_LIST=(
1818 " lib/ext/listExt"
1919)
2020
21- EXAMPLES =(
21+ EC_EXAMPLES =(
2222 " test/ext_error-credits/amortised_hash.rav"
2323 " test/ext_error-credits/cf_hashmap.rav"
2424 " test/ext_error-credits/ec_dynamic_vec.rav"
25- #
25+ )
26+
27+ PROPH_EXAMPLES=(
2628 " test/ext_prophecy/clairvoyant_coin.rav"
2729 " test/ext_prophecy/lazy_coin.rav"
2830 " test/ext_prophecy/rdcss.rav"
@@ -89,22 +91,19 @@ count_line() {
8991
9092
9193run_benchmark () {
92- # local array_name=$1
94+ local array_name=" $1 [@] "
9395 local args=$2
94- # local files=("${!array_name}")
95- # Print table header
96- printf " %-45s %10s %10s %10s %10s %10s\n" " File" " ProgLen" " ProofDecl" " ProofInstr" " Overhead" " Runtime(s)"
97- printf " %-45s %10s %10s %10s %10s %10s\n" " $( printf ' %.0s=' {1..45}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) "
96+ local files=(" ${! array_name} " )
9897
99- for file in " ${EXAMPLES [@]} " ; do
98+ for file in " ${files [@]} " ; do
10099 if [ -z " $file " ]; then
101100 echo " "
102101 continue
103102 fi
104103
105104 # echo "Running file $file"
106105 line_count=$( wc -l < " $file " )
107- output=$( raven " $ file" --stats)
106+ output=$( eval " raven $args ' $ file' --stats" )
108107
109108 # Extract statistics from the output
110109 program_declarations=$( echo " $output " | grep " Program Declarations" | awk ' {print $3}' )
@@ -135,7 +134,7 @@ run_benchmark() {
135134 fi
136135
137136 # Run hyperfine to measure runtime
138- runtime=$( hyperfine --warmup $WARMUP --runs $RUNS $args " raven \" $file \" " --export-json /tmp/hyperfine.json)
137+ runtime=$( hyperfine --warmup $WARMUP --runs $RUNS --export-json /tmp/hyperfine.json -- " raven $args \" $file \" " )
139138 runtime=$( jq ' .results[0].mean' /tmp/hyperfine.json)
140139 runtime=$( printf " %.3f" " $runtime " )
141140
@@ -150,4 +149,9 @@ count_line
150149echo
151150
152151echo " Table 2: Program Overhead and Runtimes for Benchmark Examples"
153- run_benchmark
152+ # Print table header
153+ printf " %-45s %10s %10s %10s %10s %10s\n" " File" " ProgLen" " ProofDecl" " ProofInstr" " Overhead" " Runtime(s)"
154+ printf " %-45s %10s %10s %10s %10s %10s\n" " $( printf ' %.0s=' {1..45}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) " " $( printf ' %.0s=' {1..10}) "
155+ run_benchmark EC_EXAMPLES " --extension eris"
156+ run_benchmark PROPH_EXAMPLES " --extension prophecy"
157+
0 commit comments