4 ms·
The problem with many of these "very fast indeed" claims, is that they usually compare to not interfacing with C at all. That is, how much is the overhead of t
by taeric 8y ago
The problem with many of these "very fast indeed" claims, is that they usually compare to not interfacing with C at all.
That is, how much is the overhead of the call from OCaml to C? Not just how much faster did the entire system get.
My hunch is that it is still quite favorable.
- rwmj 8y agoThere are two ways to call into C code from OCaml depending on whether the C code needs to allocate on the OCaml heap or not. If not (the so-called "noalloc" method) then it's just a call instruction. Otherwise it goes through a trampoline which IIRC uses a computed branch which probably kills branch prediction. One other problem is that you cannot inline C into OCaml functions (which is generally true when mixing languages) so there's always some overhead even in the noalloc case, although it will be fairly small on modern CPUs. Edit: https://camltastic.blogspot.com/2008/08/tip-calling-c-functions-directly-with.html https://camltastic.blogspot.com/2008/08/tip-calling-c-functi...