-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stuff to runtime, remove imported memory, separate test and bench
- Loading branch information
1 parent
8cb9f8a
commit 3c72d43
Showing
5 changed files
with
186 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
NODE="node-canary --stack-size=10000" | ||
|
||
ulimit -s 20000 | ||
|
||
#UNSAFE="-unsafe" | ||
UNSAFE="" | ||
|
||
bench() { | ||
echo "*** Running ${1}:" | ||
|
||
echo "" | ||
|
||
# clean-up | ||
rm -rf *.assets *.wasm *.wat *.bc *.js || true 2> /dev/null | ||
# compile native and wasocaml | ||
../../ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null | ||
# optimize wasocaml code | ||
wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen --skip-pass=inlining-optimizing a.out.wasm -o a.out.wasm -O3 | ||
# compile bytecode | ||
ocamlc $UNSAFE ./${2}.ml -o a.out.bc > /dev/null | ||
# compile wsoo | ||
wasm_of_ocaml compile --opt=3 ./a.out.bc -o a.wsoo.bc.js > /dev/null | ||
# compile jsoo | ||
js_of_ocaml compile --target-env=nodejs --opt=3 ./a.out.bc -o a.jsoo.bc.js | ||
|
||
# bench | ||
hyperfine --runs 3 \ | ||
-n "OCaml native" "./a.out" \ | ||
-n "Wasocaml" "${NODE} ./main_node.mjs" \ | ||
-n "Wsoo" "${NODE} ./a.wsoo.bc.js" \ | ||
-n "Jsoo" "${NODE} ./a.jsoo.bc.js" \ | ||
-n "Bytecode" "ocamlrun ./a.out.bc" # TODO: use ../../ocamlrun when it'll be produced | ||
|
||
echo "" | ||
} | ||
|
||
|
||
#bench "Almabench" "almabench" # global init must have correct type | ||
#bench "Binary Trees" "binary_trees" # unreachable | ||
#bench "Boyer" "boyer" # unreachable | ||
#bench "Boyer no exceptions" "boyer_no_exc" # unreachable | ||
#bench "Pfannkuchen" "fannkuch" # unreachable | ||
#bench "Pfannkuchen 2" "fannkuch2" # missing "caml_string_notequal" and "caml_lessthan" | ||
#bench "Fast Fourier Transform" "fft" # unreachable | ||
#bench "Hamming" "hamming" # missing value let-rec | ||
#bench "Nucleic" "nucleic" # unreachable | ||
#bench "Ray-Trace" "raytrace" # global init must have correct type | ||
#bench "Splay Tree" "splay" # unreachable | ||
|
||
bench "Knuth-Bendix" "kb" | ||
bench "Knuth-Bendix (no exception)" "kb_no_exc" | ||
bench "Soli" "soli" | ||
bench "Fibonacci" "fib" | ||
bench "Binary Decision Diagram" "bdd" | ||
bench "Loop" "loop" | ||
bench "Takc" "takc" | ||
bench "Taku" "taku" | ||
bench "Quicksort" "quicksort" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,102 @@ | ||
#!/bin/sh | ||
|
||
../../ocamlopt ./kb.ml | ||
../../ocamlopt ./soli.ml | ||
../../ocamlopt ./fib.ml | ||
# wasm-opt --enable-gc --enable-reference-types --enable-exception-handling --enable-multivalue --enable-tail-call a.out.wasm -o a.out.wasm -O3 | ||
python3 -m http.server 8000 --directory . | ||
set -eu | ||
|
||
ULIMIT_STACK_SIZE=20000 | ||
STACK_SIZE=10000 | ||
NODE="node-canary --stack-size=${STACK_SIZE}" | ||
|
||
ulimit -s $ULIMIT_STACK_SIZE | ||
|
||
#UNSAFE="-unsafe" | ||
UNSAFE="" | ||
|
||
bench_native() { | ||
echo -n " OCaml native: " | ||
ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null | ||
./a.out > output_${2}_ocaml_native.txt | ||
echo "OK" | ||
} | ||
|
||
bench_wasocaml_opt() { | ||
echo -n " Wasocaml + wasm-opt (node): " | ||
../../ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null | ||
wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-tail-call --enable-nontrapping-float-to-int --traps-never-happen --skip-pass=inlining-optimizing a.out.wasm -o a.out.wasm -O3 | ||
$NODE ./main_node.mjs > output_${2}_wasocaml_opt.txt | ||
diff output_${2}_ocaml_native.txt output_${2}_wasocaml_opt.txt | ||
echo "OK" | ||
} | ||
|
||
bench_wasocaml() { | ||
echo -n " Wasocaml (node): " | ||
../../ocamlopt $UNSAFE -O3 ./${2}.ml > /dev/null | ||
$NODE ./main_node.mjs > output_${2}_wasocaml.txt | ||
diff output_${2}_ocaml_native.txt output_${2}_wasocaml.txt | ||
echo "OK" | ||
} | ||
|
||
bench_wsoo() { | ||
echo -n " wasm_of_ocaml (node): " | ||
ocamlc $UNSAFE ./${2}.ml > /dev/null | ||
rm -rf a.assets* a.js a.wat || true 2> /dev/null | ||
wasm_of_ocaml compile --opt=3 ./a.out > /dev/null | ||
$NODE ./a.js > output_${2}_wsoo.txt | ||
diff output_${2}_ocaml_native.txt output_${2}_wsoo.txt | ||
echo "OK" | ||
} | ||
|
||
bench_jsoo() { | ||
echo -n " js_of_ocaml (node): " | ||
ocamlc $UNSAFE ./${2}.ml > /dev/null | ||
rm -f a.js a.wat || true 2> /dev/null | ||
js_of_ocaml compile --target-env=nodejs --opt=3 ./a.out | ||
$NODE ./a.js > output_${2}_jsoo.txt | ||
diff output_${2}_ocaml_native.txt output_${2}_jsoo.txt | ||
echo "OK" | ||
} | ||
|
||
bench_bytecode() { | ||
echo -n " OCaml bytecode: " | ||
ocamlc $UNSAFE ./${2}.ml > /dev/null | ||
ocamlrun ./a.out > output_${2}_bytecode.txt | ||
diff output_${2}_ocaml_native.txt output_${2}_bytecode.txt | ||
echo "OK" | ||
} | ||
|
||
bench() { | ||
echo "*** Running ${1}:" | ||
|
||
echo "" | ||
|
||
bench_native "${1}" "${2}" | ||
bench_wasocaml_opt "${1}" "${2}" | ||
bench_wasocaml "${1}" "${2}" | ||
bench_wsoo "${1}" "${2}" | ||
bench_jsoo "${1}" "${2}" | ||
bench_bytecode "${1}" "${2}" | ||
|
||
echo "" | ||
} | ||
|
||
|
||
#bench "Almabench" "almabench" # global init must have correct type | ||
#bench "Binary Trees" "binary_trees" # unreachable | ||
#bench "Boyer" "boyer" # unreachable | ||
#bench "Boyer no exceptions" "boyer_no_exc" # unreachable | ||
#bench "Pfannkuchen" "fannkuch" # unreachable | ||
#bench "Pfannkuchen 2" "fannkuch2" # missing "caml_string_notequal" and "caml_lessthan" | ||
#bench "Fast Fourier Transform" "fft" # unreachable | ||
#bench "Hamming" "hamming" # missing value let-rec | ||
#bench "Nucleic" "nucleic" # unreachable | ||
#bench "Ray-Trace" "raytrace" # global init must have correct type | ||
#bench "Splay Tree" "splay" # unreachable | ||
|
||
bench "Knuth-Bendix" "kb" | ||
bench "Knuth-Bendix (no exception)" "kb_no_exc" | ||
bench "Soli" "soli" | ||
bench "Fibonacci" "fib" | ||
bench "Binary Decision Diagram" "bdd" | ||
bench "Loop" "loop" | ||
bench "Takc" "takc" | ||
bench "Taku" "taku" | ||
bench "Quicksort" "quicksort" |
This file was deleted.
Oops, something went wrong.