recompile ocaml with flamda mode, update times table
This commit is contained in:
parent
608cbb2f68
commit
37a2dab610
|
@ -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 |
|
||||
| squiggle.c | 37ms | 54 |
|
||||
| Nim | 38ms | 84 |
|
||||
| OCaml | 42ms | 112 |
|
||||
| Lua (LuaJIT) | 68ms | 82 |
|
||||
| OCaml (flambda mode) | 245ms | 112 |
|
||||
| Lua | 278ms | 82 |
|
||||
| C (naïve implementation) | 292ms | 149 |
|
||||
| Javascript (NodeJS) | 732ms | 69 |
|
||||
|
|
BIN
nim/samples
BIN
nim/samples
Binary file not shown.
|
@ -1,18 +1,30 @@
|
|||
# Compiler
|
||||
CC=ocamlopt
|
||||
OC=ocamlopt
|
||||
# ocamlopt: platform-specific, faster
|
||||
# ocamlc: platform-independent intermediate representation, run with ocamlrun
|
||||
FAST=-O3 -unsafe # install flambda with opam
|
||||
|
||||
# Main file
|
||||
SRC=samples.ml
|
||||
OUT=./out/samples
|
||||
|
||||
build: $(SRC)
|
||||
$(CC) $(SRC) -o $(OUT)
|
||||
$(OC) $(SRC) -o $(OUT)
|
||||
mv samples.cmi samples.cmx samples.o ./out/
|
||||
|
||||
run:
|
||||
$(OUT)
|
||||
|
||||
fast:
|
||||
$(OC) $(FAST) $(SRC) -o $(OUT)
|
||||
mv samples.cmi samples.cmx samples.o ./out/
|
||||
|
||||
time:
|
||||
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.
14
time.txt
14
time.txt
|
@ -140,14 +140,12 @@ Time using 1 thread: 37.60ms
|
|||
|
||||
## squiggle.ml
|
||||
|
||||
— make build && make time
|
||||
ocamlopt samples.ml -o ./out/samples
|
||||
— make fast && make time
|
||||
ocamlopt -O3 -unsafe samples.ml -o ./out/samples
|
||||
mv samples.cmi samples.cmx samples.o ./out/
|
||||
bash -c "time ./out/samples"
|
||||
Mean: 0.884629
|
||||
Mean: 0.886498
|
||||
|
||||
real 0m0.425s
|
||||
user 0m0.393s
|
||||
sys 0m0.032s
|
||||
|
||||
42ms
|
||||
real 0m0.245s
|
||||
user 0m0.232s
|
||||
sys 0m0.012s
|
||||
|
|
Loading…
Reference in New Issue
Block a user