WASM benchmarks: add lucet and WAMR, update wasmtime & wasmer

This commit is contained in:
Frank Denis 2021-02-18 23:33:43 +01:00
parent afaf3aa1d8
commit 044c3ef3f2

View File

@ -2,6 +2,9 @@
MAX_MEMORY_TESTS="67108864" MAX_MEMORY_TESTS="67108864"
unset LDFLAGS
unset CFLAGS
if command -v wasm-opt >/dev/null; then if command -v wasm-opt >/dev/null; then
wasm-opt -O4 -o "${1}.tmp" "$1" && mv -f "${1}.tmp" "$1" wasm-opt -O4 -o "${1}.tmp" "$1" && mv -f "${1}.tmp" "$1"
fi fi
@ -14,13 +17,13 @@ fi
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmtime" ]; then
if command -v wasmtime >/dev/null; then if command -v wasmtime >/dev/null; then
wasmtime -o --dir=. "$1" && exit 0 wasmtime run --dir=. "$1" && exit 0
fi fi
fi fi
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer" ]; then if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasmer" ]; then
if command -v wasmer >/dev/null; then if command -v wasmer >/dev/null; then
wasmer run "$1" --backend "${WASMER_BACKEND:-cranelift}" --dir=. && exit 0 wasmer run "$1" "--${WASMER_BACKEND:-cranelift}" --dir=. && exit 0
fi fi
fi fi
@ -36,5 +39,23 @@ if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "wasm3" ]; then
fi fi
fi fi
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "iwasm" ]; then
if iwasm | grep -qi wasi >/dev/null 2>&1; then
iwasm "$1" && exit 0
fi
fi
if [ -z "$WASI_RUNTIME" ] || [ "$WASI_RUNTIME" = "lucet" ]; then
if command -v lucetc-wasi >/dev/null && command -v lucet-wasi >/dev/null; then
lucetc-wasi \
--target-cpu native \
--reserved-size "${MAX_MEMORY_TESTS}" \
--opt-level speed \
"$1" -o "${1}.so" &&
lucet-wasi --dir=.:. --max-heap-size "${MAX_MEMORY_TESTS}" "${1}.so" &&
rm -f "${1}.so" && exit 0
fi
fi
echo "WebAssembly runtime failed" >&2 echo "WebAssembly runtime failed" >&2
exit 1 exit 1