Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiplication of matrix in C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml
> 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