From 704e3d6644f11c26d56332eb1d9864feccf34c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Wed, 21 Dec 2022 15:56:45 +0100 Subject: [PATCH] More benchmarks --- .gitignore | 2 ++ Makefile | 22 +++++++++++++++++++++- src/standalone/Makefile | 2 +- src/standalone/wabt/.gitignore | 1 + src/standalone/wabt/Makefile | 7 +++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4ca41a6..516f372 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ dist/ *.bin *.assembled.wat *.o +/run_sieve +/run_sieve.c diff --git a/Makefile b/Makefile index b59033b..2f9bf25 100644 --- a/Makefile +++ b/Makefile @@ -43,5 +43,25 @@ waforthc: clean: -rm -rf $(WASM_FILES) scripts/word.wasm scripts/word.wasm.hex src/waforth.wat.tmp \ - public/waforth + public/waforth run_sieve.* + + +################################################################################ +# Sieve benchmark +################################################################################ + +run_sieve.c: src/web/benchmarks/sieve/sieve.c + (echo "#include " && cat $< && echo "int main() { printf(\"%d\\\n\", sieve(90000000)); return 0; }") > $@ + +run_sieve: run_sieve.c + $(CC) -O2 -o $@ $< + +run-sieve: run_sieve + time ./run_sieve + +run-sieve-gforth: + time gforth -m 100000 src/examples/sieve.f -e "90000000 sieve bye" + +run-sieve-gforth-fast: + time gforth-fast -m 100000 src/examples/sieve.f -e "90000000 sieve bye" diff --git a/src/standalone/Makefile b/src/standalone/Makefile index 43a7710..e703e9f 100644 --- a/src/standalone/Makefile +++ b/src/standalone/Makefile @@ -125,7 +125,7 @@ run_sieve.f: ../examples/sieve.f .PHONY: run-sieve run-sieve: run_sieve.f - ./waforth $< + time ./waforth $< .PHONY: clean clean: diff --git a/src/standalone/wabt/.gitignore b/src/standalone/wabt/.gitignore index 290c0e5..dfdcf12 100644 --- a/src/standalone/wabt/.gitignore +++ b/src/standalone/wabt/.gitignore @@ -3,3 +3,4 @@ /wasm-micro-runtime /wasmtime-* /*.tgz +/run_sieve.f diff --git a/src/standalone/wabt/Makefile b/src/standalone/wabt/Makefile index 34fe5c8..0abe9be 100644 --- a/src/standalone/wabt/Makefile +++ b/src/standalone/wabt/Makefile @@ -64,6 +64,13 @@ waforth_core.h: waforth_core.wasm .PHONY: package +run_sieve.f: ../../examples/sieve.f + (cat $< && echo "90000000 sieve") > $@ + +.PHONY: run-sieve +run-sieve: run_sieve.f + time ./waforth $< + .PHONY: check check: -rm -f test.out