time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

commit 37a2dab610e9501d16c8fb194038779d55d45949
parent 608cbb2f68935010072a00153904537b923a520e
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Sun, 15 Oct 2023 01:46:52 +0100

recompile ocaml with flamda mode, update times table

Diffstat:
MREADME.md | 2+-
Mnim/samples | 0
Mocaml/makefile | 18+++++++++++++++---
Mocaml/out/samples | 0
Mocaml/out/samples.cmi | 0
Mocaml/out/samples.cmx | 0
Mocaml/out/samples.o | 0
Mtime.txt | 14++++++--------
8 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md @@ -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 | diff --git a/nim/samples b/nim/samples Binary files differ. diff --git a/ocaml/makefile b/ocaml/makefile @@ -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) diff --git a/ocaml/out/samples b/ocaml/out/samples Binary files differ. diff --git a/ocaml/out/samples.cmi b/ocaml/out/samples.cmi Binary files differ. diff --git a/ocaml/out/samples.cmx b/ocaml/out/samples.cmx Binary files differ. diff --git a/ocaml/out/samples.o b/ocaml/out/samples.o Binary files differ. diff --git a/time.txt b/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