time-to-botec

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

commit c19738709a29ca5d865464cf5e771659e2bab9d3
parent 50fb88db7cc9216e4fb11f8f916e0f0eaf35048d
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Sun, 15 Oct 2023 02:29:29 +0100

update README

Diffstat:
MREADME.md | 8++++++--
Mtime.txt | 12++++++------
2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -25,10 +25,10 @@ The name of this repository is a pun on two meanings of "time to": "how much tim | Language | Time | Lines of code | |-----------------------------|-----------|---------------| | C (optimized, 16 threads) | 5ms | 249 | -| squiggle.c | 37ms | 54 | +| squiggle.c | 37ms | 54* | | Nim | 38ms | 84 | | Lua (LuaJIT) | 68ms | 82 | -| OCaml (flambda mode) | 245ms | 112 | +| OCaml (flambda) | 164ms | 123 | | Lua | 278ms | 82 | | C (naïve implementation) | 292ms | 149 | | Javascript (NodeJS) | 732ms | 69 | @@ -119,6 +119,10 @@ sudo ln -sf luajit-2.1.0-beta3 /usr/local/bin/luajit Overall I'm thinking that a combination of lua at least for scripting and ¿nim/C/tbd? for more serious programs could be quite powerful. +### OCaml + +OCaml was like meeting an old and forgotten friend. I found its syntax a bit clunky, but could get accustomed to it. Its list matching is nice, O(n) list element accessing, not so much. Honestly, I wanted to really like it, but I'm not sure yet. And it's *slow* compared to C. + ### Overall thoughts Overall I don't think that this is a fair comparison of the languages intrinsically, because I'm just differentially good at them, because I've chosen to put more effort in ones than in others. But it is still useful to me personally, and perhaps mildly informative to others. diff --git a/time.txt b/time.txt @@ -140,12 +140,12 @@ Time using 1 thread: 37.60ms ## squiggle.ml -— make fast && make time +— make fast && time make run ocamlopt -O3 -unsafe samples.ml -o ./out/samples mv samples.cmi samples.cmx samples.o ./out/ -bash -c "time ./out/samples" -Mean: 0.886498 +./out/samples +Mean: 0.884629 -real 0m0.245s -user 0m0.232s -sys 0m0.012s +real 0m0.164s +user 0m0.159s +sys 0m0.004s