From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A2F94BC8E for ; Tue, 8 Feb 2005 16:59:11 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j18FxBX6005431 for ; Tue, 8 Feb 2005 16:59:11 +0100 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 QAA28714 for ; Tue, 8 Feb 2005 16:59:10 +0100 (MET) Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [217.110.154.194]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j18Fx8MN005425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Feb 2005 16:59:10 +0100 Received: from [192.168.125.193] ([192.168.125.193]) by grisu.bik-gmbh.de (8.12.11/8.12.11) with ESMTP id j18Fx7OX050632; Tue, 8 Feb 2005 16:59:07 +0100 (CET). Message-ID: <4208E1C6.3000401@bik-gmbh.de> Date: Tue, 08 Feb 2005 16:59:02 +0100 From: Florian Hars User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20040924 Debian/1.7.3-1ubuntu1 X-Accept-Language: en MIME-Version: 1.0 To: Xavier Leroy Cc: Christophe TROESTLER , "O'Caml Mailing List" Subject: Re: [Caml-list] [Benchmark] NBody References: <20050207.195724.87945401.Christophe.Troestler@umh.ac.be> <20050208104312.GA10035@yquem.inria.fr> In-Reply-To: <20050208104312.GA10035@yquem.inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4208E1CF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4208E1CC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; florian:01 hars:01 hars:01 bik-gmbh:01 caml-list:01 wrote:01 ocaml:01 gcc:01 ocaml:01 stack:01 model:01 gcc:01 -ne:01 ocamlopt:01 -inline:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Xavier Leroy wrote: > Ah, another micro-benchmark. Great pasttime! I tried it on an Athlon64, with ocaml 3.08.1 and gcc 3.3.4, and the ocaml version is consistently within a factor of 1.5 of the C version (which is faster than the C version with -ffast-math). (See blow for data.) > The x86 floating-point stack is an awfully bad match for the > register-based OCaml code generation model Bu given that the ocaml code generator is register based, I am a bit surprised that it uses only a bit more a third of the FP registers on an Athlon64: $ gcc -O3 -S nbody.c $ perl -ne 'while (/(xmm\d+)/g) {print "$1\n"}' nbody.s | sort -u | wc -l 16 $ ocamlopt -o nbody_ml40 -inline 40 -unsafe -S nbody.ml $ perl -ne 'while (/(xmm\d+)/g) {print "$1\n"}' nbody.s | sort -u | wc -l 6 Yours, Florian. ----- Cutting here may damage your screen ----- ocamlopt -o nbody_ml10 -inline 10 -unsafe nbody.ml ocamlopt -o nbody_ml40 -inline 40 -unsafe nbody.ml ocamlopt -o nbody_ml40s -inline 40 nbody.ml gcc -O3 -o nbody_c nbody.c -lm gcc -ffast-math -O3 -o nbody_cf nbody.c -lm n ml10 ml40 ml40s c cf 1000 0.00 0.00 0.00 0.00 0.00 10000 0.01 0.01 0.01 0.01 0.01 100000 0.15 0.12 0.14 0.10 0.11 200000 0.19 0.10 0.11 0.08 0.09 500000 0.31 0.25 0.28 0.21 0.22 1000000 0.60 0.50 0.56 0.43 0.45 2000000 1.22 1.00 1.12 0.87 0.90 3000000 1.83 1.50 1.68 1.30 1.35 4000000 2.35 2.00 2.24 1.71 1.80