commit 608cbb2f68935010072a00153904537b923a520e
parent 25a27f7fc48436cfbb35c44cec5e56a29e53f170
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Sun, 15 Oct 2023 01:19:56 +0100
add initial OCaml stats
Diffstat:
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -27,6 +27,7 @@ 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 |
| Lua | 278ms | 82 |
| C (naïve implementation) | 292ms | 149 |
@@ -128,7 +129,7 @@ Overall I don't think that this is a fair comparison of the languages intrinsica
- [ ] bc (the standard posix calculator)
- [ ] Zig
- [ ] Rust
-- [ ] OCaml
+- [x] OCaml
- [ ] Forth
- [ ] Julia (TuringML, MCHammer)
- [ ] Lisp
diff --git a/ocaml/makefile b/ocaml/makefile
@@ -5,10 +5,14 @@ CC=ocamlopt
# Main file
SRC=samples.ml
+OUT=./out/samples
build: $(SRC)
- $(CC) $(SRC) -o out/samples
+ $(CC) $(SRC) -o $(OUT)
mv samples.cmi samples.cmx samples.o ./out/
run:
- ./out/samples
+ $(OUT)
+
+time:
+ bash -c "time $(OUT)"
diff --git a/time.txt b/time.txt
@@ -138,3 +138,16 @@ Requires /bin/time, found on GNU/Linux systems
Running 100x and taking avg time example
Time using 1 thread: 37.60ms
+## squiggle.ml
+
+— make build && make time
+ocamlopt samples.ml -o ./out/samples
+mv samples.cmi samples.cmx samples.o ./out/
+bash -c "time ./out/samples"
+Mean: 0.884629
+
+real 0m0.425s
+user 0m0.393s
+sys 0m0.032s
+
+42ms