recompile ocaml with flamda mode, update times table

This commit is contained in:
NunoSempere 2023-10-15 01:46:52 +01:00
parent 608cbb2f68
commit 37a2dab610
8 changed files with 22 additions and 12 deletions

View File

@ -27,8 +27,8 @@ The name of this repository is a pun on two meanings of "time to": "how much tim
| C (optimized, 16 threads) | 5ms | 249 | | C (optimized, 16 threads) | 5ms | 249 |
| squiggle.c | 37ms | 54 | | squiggle.c | 37ms | 54 |
| Nim | 38ms | 84 | | Nim | 38ms | 84 |
| OCaml | 42ms | 112 |
| Lua (LuaJIT) | 68ms | 82 | | Lua (LuaJIT) | 68ms | 82 |
| OCaml (flambda mode) | 245ms | 112 |
| Lua | 278ms | 82 | | Lua | 278ms | 82 |
| C (naïve implementation) | 292ms | 149 | | C (naïve implementation) | 292ms | 149 |
| Javascript (NodeJS) | 732ms | 69 | | Javascript (NodeJS) | 732ms | 69 |

Binary file not shown.

View File

@ -1,18 +1,30 @@
# Compiler # Compiler
CC=ocamlopt OC=ocamlopt
# ocamlopt: platform-specific, faster # ocamlopt: platform-specific, faster
# ocamlc: platform-independent intermediate representation, run with ocamlrun # ocamlc: platform-independent intermediate representation, run with ocamlrun
FAST=-O3 -unsafe # install flambda with opam
# Main file
SRC=samples.ml SRC=samples.ml
OUT=./out/samples OUT=./out/samples
build: $(SRC) build: $(SRC)
$(CC) $(SRC) -o $(OUT) $(OC) $(SRC) -o $(OUT)
mv samples.cmi samples.cmx samples.o ./out/ mv samples.cmi samples.cmx samples.o ./out/
run: run:
$(OUT) $(OUT)
fast:
$(OC) $(FAST) $(SRC) -o $(OUT)
mv samples.cmi samples.cmx samples.o ./out/
time: time:
bash -c "time $(OUT)" bash -c "time $(OUT)"
switch-opam-fast:
opam switch create 4.11.2+flambda
eval $(opam env)
switch-opam-5.1.0:
opam switch create 5.1.0
eval $(opam env)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -140,14 +140,12 @@ Time using 1 thread: 37.60ms
## squiggle.ml ## squiggle.ml
— make build && make time — make fast && make time
ocamlopt samples.ml -o ./out/samples ocamlopt -O3 -unsafe samples.ml -o ./out/samples
mv samples.cmi samples.cmx samples.o ./out/ mv samples.cmi samples.cmx samples.o ./out/
bash -c "time ./out/samples" bash -c "time ./out/samples"
Mean: 0.884629 Mean: 0.886498
real 0m0.425s real 0m0.245s
user 0m0.393s user 0m0.232s
sys 0m0.032s sys 0m0.012s
42ms