That's good to know. Thanks for clarifying.

Yotam

On Wed, Sep 10, 2014 at 8:37 AM, Adrien Nader <adrien@notk.org> wrote:
On Wed, Sep 10, 2014, Gerd Stolpmann wrote:
> Am Mittwoch, den 10.09.2014, 08:07 -0400 schrieb Yotam Barnoy:
> > Another reason is performance. The generic, polymorphic comparison
> > function drops you out into C (which has a cost)
>
> Don't think so. compare doesn't allocate memory, so the few extra
> instructions in caml_c_call for making allocation available from C
> aren't required. Calling compare shouldn't be slower than calling a
> function written in OCaml.

And calling C from OCaml is _very_ fast. Too fast to be a concern.

The other way round is slower, iirc maybe by a 100 factor.

(you should benchmark yourself if any of these might be a concern)

--
Adrien Nader