From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA01343 for caml-red; Sat, 25 Nov 2000 15:34:38 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA24856 for ; Thu, 23 Nov 2000 14:03:38 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eAND3a114186; Thu, 23 Nov 2000 14:03:36 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA16697; Thu, 23 Nov 2000 14:03:36 +0100 (MET) Date: Thu, 23 Nov 2000 14:03:36 +0100 From: Xavier Leroy To: Mattias Waldau Cc: caml-list@inria.fr Subject: Re: OCaml is fast! Message-ID: <20001123140336.A13264@pauillac.inria.fr> References: <20001121090507.A31518@opus.davidb.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from mattias.waldau@abc.se on Wed, Nov 22, 2000 at 10:35:56PM +0100 Sender: weis@pauillac.inria.fr > or is my benchmark wrong? The speed is incredable, I have a 333 Mhz PII, and > Ocaml make 50 miljon round trips in the loop per second, that is 6 cycles > per loop, and in each loop one function call + add + store is done. > > Or does the compiler optimize away a lot of my code? The code can be found > in the end of the file. The functions nooo_init and nooo_move are small enough to be inlined, so the loops in test_nooo_speed and test_nooo_speed_2 perform no function calls. To measure the cost of function calls, you can disable inlining with the "-inline 0" compiler flag. Methods are never inlined at point of call, though, because it would require global program analysis. One last suggestion: if you use Unix.gettimeofday instead of Unix.time, you'll get sub-second resolution for the timings. - Xavier Leroy