From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 72E70BC6A for ; Thu, 8 Feb 2007 11:46:02 +0100 (CET) Received: from [128.93.11.95] (estephe.inria.fr [128.93.11.95]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l18AjktB010803; Thu, 8 Feb 2007 11:45:47 +0100 Message-ID: <45CAFF5A.2020607@inria.fr> Date: Thu, 08 Feb 2007 11:45:46 +0100 From: Xavier Leroy User-Agent: Thunderbird 1.5.0.7 (X11/20060915) MIME-Version: 1.0 To: gava@univ-paris12.fr Cc: Jacques Garrigue , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml References: <45CA63F5.6020301@univ-paris12.fr> <20070208.111401.55511744.garrigue@math.nagoya-u.ac.jp> <45CAF3E2.7020807@univ-paris12.fr> In-Reply-To: <45CAF3E2.7020807@univ-paris12.fr> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45CAFF5A.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 mult:01 gcc:01 speedup:01 invoke:01 compile:01 caml-list:01 functions:01 undefined:01 optimization:03 jacques:03 behaviors:04 xavier:06 xavier:06 > 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