ocaml and C
I have read a lot of different places that ocaml is very fast, even faster than C, but it's always a stupid "yes-no I have no evidence" argument that doesn't expand anyone's knowledge. I have searched around the web and actual benchmarks I find, C always (edit: more searching = almost always actually) wins; am I looking in the wrong place or what?
Obviously specific languages will never be better in every possible situation, can anyone show me some places where ocaml is faster (source provided please, I am ocaml literate), or give theoretical arguments about why ocaml should be faster in situation X?
To answer the real question:
is OCAML faster than C?
that would depend on the code itself, as well as compiler options.
both are low level languages, with support for direct hardware control.
so it would really depend on how the application was written as to which is faster.
it really is a matter of how the tool was coded, rather than which will produce faster executables. unlike interpreted vs compiled, with 2 compiled languages it's all in the actual code used.
Sorry I wasn't more specific, assuming a single algorithm is written in C and ocaml, compiled for ia-32 and run a lot of times, which will perform better. From statistics I have seen thus far, C compilers seem to be better with the instruction set.
For example a mul and an add will be much slower than a lea (when that's possible) and a cmovz will be faster than a jnz (to jump over a mov).
edit: also I see ocaml brag about its recursion.