From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA00160; Tue, 6 Nov 2001 11:05:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA32472 for ; Tue, 6 Nov 2001 11:05:47 +0100 (MET) Received: from scan1.fhg.de (scan1.fhg.de [153.96.1.35]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id fA6A5kD11929 for ; Tue, 6 Nov 2001 11:05:46 +0100 (MET) Received: from scan1.fhg.de (localhost [127.0.0.1]) by scan1.fhg.de (8.11.1/8.11.1) with ESMTP id fA6A5bH19769 for ; Tue, 6 Nov 2001 11:05:37 +0100 (MET) Received: from kso.ilt.fhg.de (eeltc2.llt.RWTH-Aachen.DE [137.226.44.2]) by scan1.fhg.de (8.11.1/8.11.1) with ESMTP id fA6A5aP19765 for ; Tue, 6 Nov 2001 11:05:36 +0100 (MET) Received: from ilt.fhg.de (ilt.ilt.fhg.de [153.96.180.2]) by kso.ilt.fhg.de (8.11.1/8.11.1) with ESMTP id fA6A7kD28911 for ; Tue, 6 Nov 2001 11:07:46 +0100 (MET) Received: from eent359 (localhost [127.0.0.1]) by ilt.fhg.de (8.11.1/8.11.1) with ESMTP id fA6A67i17027 for ; Tue, 6 Nov 2001 11:06:07 +0100 (MET) From: "Rolf Wester" To: caml-list@inria.fr Date: Tue, 6 Nov 2001 11:05:35 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: Quoted-printable Subject: [Caml-list] Re: OCaml speed Message-ID: <3BE7C3FF.29312.161FE94D@localhost> X-mailer: Pegasus Mail for Win32 (v3.12cDE) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Christophe Raffalli wrote: > Rolf Wester a =E9crit : > > > > Hi, > > > > I used the array access example from > > http://www.bagley.org/~doug/shootout/ to compare c/c++ speed against > > ocaml. The sources I used are attached below. Unfortunately I could > > not confirm the given cpu times which are 0.11 sec for gcc and 0.13 > > for ocamlopt. My results on a Compaq Alpha True64 are 0.05 for cxx, > > 0.1 for g++ and 0.29 for ocamlopt. Does anybody have an idea what > > could be the reason for this inconsistency? Did I do anything wrong? > > > > Your code mainly does integer operations and array accesses. > > The main difference between C and Ocaml are the reserved bit in integer > used by ocaml for the GC. Then the generated assembly code are really > different and it is possible that this diffrence cost nothing (almost) > on a pentium and a lot on a Alpha True64. > > May be Xavier Leroy could look at the assembly code to tell if I am > right ? > > You could also try with float arrays which should make less difference > for your code ? > I tried it with floats. The differences are quite similar. With -unsafe I get a speedup of almost 100%. I mostly do numerical computations with heavy use of arrays. OCamls array performance is sufficient for some of my applications but there are still quite a lot of problems that need better performance so I'm stuck with C/C++ either as OCaml extension or without OCaml. I'm thinking about a numerical extension written in C comparable to the Python Numpy package. At the moment I try to interface with the FFTW library. The biggest problem is that there is no OCaml build in type complex and that the Bigarray doesn't have complex too (sometime ago I read that someone was thinking about adding complex numbers to the Bigarray module, I would appreciate this very much). Rolf Wester ------------------------------------- Rolf Wester rolf.wester@ilt.fraunhofer.de ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr