More benchmarks

This commit is contained in:
Remko Tronçon 2022-12-21 15:56:45 +01:00
parent f2c4871809
commit 704e3d6644
5 changed files with 32 additions and 2 deletions

2
.gitignore vendored
View file

@ -13,3 +13,5 @@ dist/
*.bin
*.assembled.wat
*.o
/run_sieve
/run_sieve.c

View file

@ -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 <stdio.h>" && 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"

View file

@ -125,7 +125,7 @@ run_sieve.f: ../examples/sieve.f
.PHONY: run-sieve
run-sieve: run_sieve.f
./waforth $<
time ./waforth $<
.PHONY: clean
clean:

View file

@ -3,3 +3,4 @@
/wasm-micro-runtime
/wasmtime-*
/*.tgz
/run_sieve.f

View file

@ -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