languages icon indicating copy to clipboard operation
languages copied to clipboard

Add OCaml benchmark

Open juliojgd opened this issue 1 year ago • 3 comments

juliojgd avatar Nov 29 '24 21:11 juliojgd

Just adding my 2¢ in passing, but using tail-recursion (TCO) in OCaml is something taught and emphasized from the very beginning.

The current code (with TCO removed) is simply never done, it's not an accurate representation of real OCaml code. The original version was correct because, yes, we modify every recursive algorithm to make them tail-recursive whenever possible. That's just how we do it.

From the README:

Emphasizes function call overhead and recursion.

Recursion is one of OCaml's strengths thanks to TCO and real-life code uses TCO as much as possible. It's a fundamental aspect of the language, so let's show it off!

EDIT: I think you should also use -O3 and any other applicable performance compilation flags.

SGrondin avatar Dec 04 '24 19:12 SGrondin

Sadly the "tail-recursive" version is O(N) and not O(2^N)

ghost avatar Dec 21 '24 10:12 ghost

I think this looks compliant, but it is outdated and needs to be rewritten to target the current benchmark runner. See the README about this, and also #371.

PEZ avatar Feb 09 '25 17:02 PEZ