echo "*** Benching Array.to_s performance ***"
fi
- ../bin/nitg --global ./strings/array_tos.nit -m ./strings/array_to_s_vars/array_to_s_rope.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+ ../bin/nitg --global ./strings/array_tos.nit -m ./strings/array_to_s_vars/array_to_s_flatstr.nit -m ../lib/standard/ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
prepare_res arr_tos_ropes.out arr_tos_ropes ropes
if $verbose; then
bench_command $i ropes$i ./array_tos --loops $2 --strlen $i --ccts $1 "NIT_GC_CHOOSER=large"
done
+ ../bin/nitg --global ./strings/array_tos.nit -m ./strings/array_to_s_vars/array_to_s_flatstr.nit -m ../lib/standard/ropes.nit -m ../lib/buffered_ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res arr_tos_buf_ropes.out arr_tos_buf_ropes buffered_ropes
+ if $verbose; then
+ echo "Buffered Ropes :"
+ fi
+ for i in `seq 1 "$3"`; do
+ if $verbose; then
+ echo "String length = $i, Concats/loop = $1, Loops = $2"
+ fi
+ bench_command $i buf_ropes$i ./array_tos --loops $2 --strlen $i --ccts $1 "NIT_GC_CHOOSER=large"
+ done
+
../bin/nitg --global ./strings/array_tos.nit -m ./strings/array_to_s_vars/array_to_s_flatstr.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
prepare_res arr_tos_flat.out arr_tos_flat flatstring
prepare_res arr_tos_man_buf.out arr_tos_man_buf flatbuf_with_capacity
if $verbose; then
- echo "Memmove :"
+ echo "FlatBuffer.with_capacity :"
fi
for i in `seq 1 "$3"`; do
if $verbose; then
bench_command $i flatbuf_with_capacity$i ./array_tos --loops $2 --strlen $i --ccts $1 "NIT_GC_CHOOSER=large"
done
+ ../bin/nitg --global ./strings/array_tos.nit -m ./strings/array_to_s_vars/array_to_s_rope_buf.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res arr_tos_rope_buf.out arr_tos_rope_buf ropebuf
+ if $verbose; then
+ echo "RopeBuffer :"
+ fi
+ for i in `seq 1 "$3"`; do
+ if $verbose; then
+ echo "String length = $i, Concats/loop = $1, Loops = $2"
+ fi
+ bench_command $i ropebuf$i ./array_tos --loops $2 --strlen $i --ccts $1 "NIT_GC_CHOOSER=large"
+ done
+
plot array_tos.gnu
}
function bench_concat()
{
- if $verbose; then
- echo "*** Benching concat performance ***"
- fi
+ ../bin/nitg --global ./strings/chain_concat.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+ ../bin/nitg --global ./strings/utf_chain_concat.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
- prepare_res concat_ropes.out concat_ropes ropes
if $verbose; then
- echo "Ropes :"
+ echo "*** Benching concat performance ***"
fi
- for i in `seq 1 "$1"`; do
- if $verbose; then
- echo "String length = $i, Concats/loop = $2, Loops = $3"
- fi
- bench_command $i ropes$i ./chain_concat -m rope --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
- done
prepare_res concat_flat.out concat_flat flatstring
if $verbose; then
bench_command $i flatstr_utf8_noindex$i ./utf_chain_concat -m flatstr_utf8_noindex --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
- plot concat.gnu
-}
+ ../bin/nitg --global ./strings/chain_concat.nit -m ../lib/standard/ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-function bench_iteration()
-{
+ prepare_res concat_ropes.out concat_ropes ropes
if $verbose; then
- echo "*** Benching iteration performance ***"
+ echo "Ropes :"
fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String length = $i, Concats/loop = $2, Loops = $3"
+ fi
+ bench_command $i ropes$i ./chain_concat -m flatstr --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
- prepare_res iter_ropes_iter.out iter_ropes_iter ropes_iter
+ ../bin/nitg --global ./strings/chain_concat.nit -m ../lib/standard/ropes.nit -m ../lib/buffered_ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res concat_buf_ropes.out concat_buf_ropes buffered_ropes
if $verbose; then
- echo "Ropes by iterator :"
+ echo "buffered ropes :"
fi
for i in `seq 1 "$1"`; do
if $verbose; then
- echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
+ echo "string length = $i, concats/loop = $2, loops = $3"
fi
- bench_command $i ropes_iter$i ./iteration_bench -m rope --iter-mode iterator --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ bench_command $i buf_ropes$i ./chain_concat -m flatstr --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
- prepare_res iter_ropes_index.out iter_ropes_index ropes_index
+ ../bin/nitg --global ./strings/chain_cct_ropebuf.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res cct_buf_ropes.out cct_buf_ropes cctbuf_ropes
if $verbose; then
- echo "Ropes by index :"
+ echo "buffered ropes :"
fi
for i in `seq 1 "$1"`; do
if $verbose; then
- echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
+ echo "string length = $i, concats/loop = $2, loops = $3"
fi
- bench_command $i ropes_index$i ./iteration_bench -m rope --iter-mode index --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ bench_command $i cctbuf_ropes$i ./chain_cct_ropebuf --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
+ plot concat.gnu
+}
+
+function bench_iteration()
+{
+ if $verbose; then
+ echo "*** Benching iteration performance ***"
+ fi
+
+ ../bin/nitg --global ./strings/iteration_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+ ../bin/nitg --global ./strings/utf_iteration_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
prepare_res iter_flat_iter.out iter_flat_iter flatstring_iter
if $verbose; then
echo "FlatStrings by iterator :"
bench_command $i flatstr_index_utf8_noindex$i ./utf_iteration_bench -m flatstr_utf8_noindex --iter-mode index --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
- plot iter.gnu
-}
+ ../bin/nitg --global ./strings/iteration_bench.nit -m ../lib/standard/ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-function bench_substr()
-{
+ prepare_res iter_ropes_iter.out iter_ropes_iter ropes_iter
if $verbose; then
- echo "*** Benching substring performance ***"
+ echo "Ropes by iterator :"
fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
+ fi
+ bench_command $i ropes_iter$i ./iteration_bench -m flatstr --iter-mode iterator --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
- prepare_res substr_ropes.out substr_ropes ropes
+ prepare_res iter_ropes_index.out iter_ropes_index ropes_index
if $verbose; then
- echo "Ropes :"
+ echo "Ropes by index :"
fi
for i in `seq 1 "$1"`; do
if $verbose; then
- echo "String length = $i, loops = $2, Loops = $3"
+ echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
+ fi
+ bench_command $i ropes_index$i ./iteration_bench -m flatstr --iter-mode index --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
+
+ ../bin/nitg --global ./strings/iteration_bench.nit -m ../lib/standard/ropes.nit -m ../lib/buffered_ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res iter_buf_ropes_iter.out iter_buf_ropes_iter buf_ropes_iter
+ if $verbose; then
+ echo "Buffered Ropes by iterator :"
+ fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
+ fi
+ bench_command $i buf_ropes_iter$i ./iteration_bench -m flatstr --iter-mode iterator --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
+
+ prepare_res iter_buf_ropes_index.out iter_buf_ropes_index buf_ropes_index
+ if $verbose; then
+ echo "Buffered Ropes by index :"
+ fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String base length = $1, Concats (depth of the rope) = $i, Loops = $3"
fi
- bench_command $i ropes$i ./substr_bench -m rope --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ bench_command $i buf_ropes_index$i ./iteration_bench -m flatstr --iter-mode index --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
+ plot iter.gnu
+}
+
+function bench_substr()
+{
+ if $verbose; then
+ echo "*** Benching substring performance ***"
+ fi
+
+ ../bin/nitg --global ./strings/substr_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+ ../bin/nitg --global ./strings/utf_substr_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
prepare_res substr_flat.out substr_flat flatstring
if $verbose; then
echo "FlatStrings :"
bench_command $i flatstring_utf8_noindex$i ./utf_substr_bench -m flatstr_utf8_noindex --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
done
+ ../bin/nitg --global ./strings/substr_bench.nit -m ../lib/standard/ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res substr_ropes.out substr_ropes ropes
+ if $verbose; then
+ echo "Ropes :"
+ fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String length = $i, loops = $2, Loops = $3"
+ fi
+ bench_command $i ropes$i ./substr_bench -m flatstr --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
+
+ ../bin/nitg --global ./strings/substr_bench.nit -m ../lib/standard/ropes.nit -m ../lib/buffered_ropes.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
+
+ prepare_res substr_buf_ropes.out substr_buf_ropes buf_ropes
+ if $verbose; then
+ echo "Buffered Ropes :"
+ fi
+ for i in `seq 1 "$1"`; do
+ if $verbose; then
+ echo "String length = $i, loops = $2, Loops = $3"
+ fi
+ bench_command $i buf_ropes$i ./substr_bench -m flatstr --loops $2 --strlen $3 --ccts $i "NIT_GC_CHOOSER=large"
+ done
plot substr.gnu
}
exit
fi
-if $verbose; then
- echo "Compiling"
-fi
-
-../bin/nitg --global ./strings/chain_concat.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-../bin/nitg --global ./strings/utf_chain_concat.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-../bin/nitg --global ./strings/iteration_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-../bin/nitg --global ./strings/utf_iteration_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-../bin/nitg --global ./strings/substr_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-../bin/nitg --global ./strings/utf_substr_bench.nit --make-flags "CFLAGS=\"-g -O2 -DNOBOEHM\""
-
case "$1" in
iter) shift; bench_iteration $@ ;;
cct) shift; bench_concat $@ ;;
import opts
-fun bench_rope_iter(nb_cct: Int, loops: Int, strlen: Int)
-do
- var a = "a" * strlen
- var x:String = new RopeString.from(a)
- for i in [0 .. nb_cct] do x += a
- var cnt = 0
- var c: Char
- while cnt != loops do
- for i in x do
- c = i
- end
- cnt += 1
- end
-end
-
-fun bench_rope_index(nb_cct: Int, loops: Int, strlen: Int)
-do
- var a = "a" * strlen
- var x:String = new RopeString.from(a)
- for i in [0 .. nb_cct] do x += a
- var cnt = 0
- var c: Char
- var pos = 0
- while cnt != loops do
- pos = 0
- while pos < x.length do
- c = x[pos]
- pos += 1
- end
- cnt += 1
- end
-end
-
fun bench_flatstr_iter(nb_cct: Int, loops: Int, strlen: Int)
do
var a = "a" * strlen
end
var opts = new OptionContext
-var mode = new OptionEnum(["rope", "flatstr", "flatbuf"], "Mode", -1, "-m")
+var mode = new OptionEnum(["flatstr", "flatbuf"], "Mode", -1, "-m")
var access_mode = new OptionEnum(["iterator", "index"], "Iteration mode", -1, "--iter-mode")
var nb_ccts = new OptionInt("Number of concatenations done to the string (in the case of the rope, this will increase its depth)", -1, "--ccts")
var loops = new OptionInt("Number of loops to be done", -1, "--loops")
if modval == 0 then
if iterval == 0 then
- bench_rope_iter(nb_ccts.value, loops.value, strlen.value)
- else if iterval == 1 then
- bench_rope_index(nb_ccts.value, loops.value, strlen.value)
- else
- opts.usage
- exit(-1)
- end
-else if modval == 1 then
- if iterval == 0 then
bench_flatstr_iter(nb_ccts.value, loops.value, strlen.value)
else if iterval == 1 then
bench_flatstr_index(nb_ccts.value, loops.value, strlen.value)
opts.usage
exit(-1)
end
-else if modval == 2 then
+else if modval == 1 then
if iterval == 0 then
bench_flatbuf_iter(nb_ccts.value, loops.value, strlen.value)
else if iterval == 1 then