> In the file, I give how I compile, How I run and the result. Here C is 5
> time faster than OCaml
> Many thanks to tell me why my OCaml code is so slow.
Because, as Jacques told you already, your C code is wrong. "add" and
"mult" invoke undefined behaviors of C and therefore gcc feels free to
optimize these functions as no-ops at optimization levels 1 and above.
That's a major speedup, for sure. Why don't you check your code for
correctness first before drawing conclusions on performance?
- Xavier Leroy