add initial OCaml stats

This commit is contained in:
NunoSempere 2023-10-15 01:19:56 +01:00
parent 25a27f7fc4
commit 608cbb2f68
3 changed files with 21 additions and 3 deletions

View File

@ -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 | | 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 |
| Lua | 278ms | 82 | | Lua | 278ms | 82 |
| C (naïve implementation) | 292ms | 149 | | 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) - [ ] bc (the standard posix calculator)
- [ ] Zig - [ ] Zig
- [ ] Rust - [ ] Rust
- [ ] OCaml - [x] OCaml
- [ ] Forth - [ ] Forth
- [ ] Julia (TuringML, MCHammer) - [ ] Julia (TuringML, MCHammer)
- [ ] Lisp - [ ] Lisp

View File

@ -5,10 +5,14 @@ CC=ocamlopt
# Main file # Main file
SRC=samples.ml SRC=samples.ml
OUT=./out/samples
build: $(SRC) build: $(SRC)
$(CC) $(SRC) -o out/samples $(CC) $(SRC) -o $(OUT)
mv samples.cmi samples.cmx samples.o ./out/ mv samples.cmi samples.cmx samples.o ./out/
run: run:
./out/samples $(OUT)
time:
bash -c "time $(OUT)"

View File

@ -138,3 +138,16 @@ Requires /bin/time, found on GNU/Linux systems
Running 100x and taking avg time example Running 100x and taking avg time example
Time using 1 thread: 37.60ms 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