caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florian Hars <hars@bik-gmbh.de>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>,
	"O'Caml Mailing List" <caml-list@inria.fr>
Subject: Re: [Caml-list] [Benchmark] NBody
Date: Tue, 08 Feb 2005 16:59:02 +0100	[thread overview]
Message-ID: <4208E1C6.3000401@bik-gmbh.de> (raw)
In-Reply-To: <20050208104312.GA10035@yquem.inria.fr>

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


  parent reply	other threads:[~2005-02-08 15:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-07 18:57 Christophe TROESTLER
2005-02-07 19:16 ` [Caml-list] " Will M. Farr
2005-02-07 19:36   ` Christophe TROESTLER
2005-02-07 19:55     ` Will M. Farr
2005-02-08 10:34       ` Olivier Andrieu
2005-02-08 10:52         ` Micha
2005-02-07 20:16     ` Markus Mottl
2005-02-07 19:37 ` Martin Jambon
2005-02-07 19:46   ` Christophe TROESTLER
2005-02-07 20:22     ` Martin Jambon
2005-02-07 20:04   ` sejourne_kevin
2005-02-07 20:32     ` Robert Roessler
2005-02-07 22:57     ` Oliver Bandel
2005-02-08  1:29 ` skaller
2005-02-08  1:48   ` Will M. Farr
2005-02-08  9:01     ` Ville-Pertti Keinonen
2005-02-08  9:37     ` skaller
2005-02-08 10:10       ` Ville-Pertti Keinonen
2005-02-08 16:36         ` skaller
2005-02-08 12:04       ` Marcin 'Qrczak' Kowalczyk
2005-02-08 17:06         ` skaller
2005-02-08 10:25   ` Xavier Leroy
2005-02-08 18:34     ` skaller
2005-02-08 10:43 ` Xavier Leroy
2005-02-08 11:26   ` Ville-Pertti Keinonen
2005-02-08 15:59   ` Florian Hars [this message]
2005-02-13 16:40   ` Christoph Bauer
2005-02-13 18:13   ` Christophe TROESTLER
2005-02-24 22:18   ` NBody (one more question) Christophe TROESTLER
2005-02-25 17:06     ` [Caml-list] " John Carr
2005-02-25 17:17       ` Christophe TROESTLER
2005-02-26 16:08         ` John Carr
2005-02-25 17:24     ` Ken Rose
2005-02-25 17:42       ` Oliver Bandel
2005-02-25 17:57     ` Xavier Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4208E1C6.3000401@bik-gmbh.de \
    --to=hars@bik-gmbh.de \
    --cc=Christophe.Troestler@umh.ac.be \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).