From: John Prevost <j.prevost@gmail.com>
To: "Will M. Farr" <farr@mit.edu>
Cc: shootout-list@lists.alioth.debian.org, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance
Date: Thu, 13 Jan 2005 12:29:32 -0500 [thread overview]
Message-ID: <d849ad2a05011309291f121d61@mail.gmail.com> (raw)
In-Reply-To: <3D3A6BF5-657B-11D9-A551-000393A34E82@mit.edu>
On Thu, 13 Jan 2005 10:53:16 -0500, Will M. Farr <farr@mit.edu> wrote:
> Each invocation was compiled with "ocamlopt -unsafe -noassert
> -o harmonic harmonic.ml". It looks like using references and
> loops is *by far* the fastest (and also that my PowerBook is
> pretty slow to convert int->float, but I don't think this is
> related to ocaml, since the C version does the same thing).
Note that this is dependent on what CPU you're using. On my test
system (700MHz AMD Athlon with 256MB of memory), I saw this behavior:
time ./harmonic 1000000000:
harmonic:
you: 2m01.590s .. 0m00.790s
me: 0m30.811s .. 0m00.120s
harmonic2:
you: 2m00.340s .. 0m00.440s
me: 0m30.847s .. 0m00.140s
harmonic3:
you: 1m44.350s .. 0m00.740s
me: 0m38.002s .. 0m00.130s
harmonic4:
you: 1m12.680s .. 0m00.430s
me: 1m14.603s .. 0m00.220s
So on this system, harmonic4 is by far the slowest, and the fastest
version is the one that uses float_of_int and tail recursion. It's
unclear to me how much of this is that the Intel compiler is simply
better optimized than the PPC compiler.
John.
next prev parent reply other threads:[~2005-01-13 17:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 15:53 Will M. Farr
2005-01-13 17:29 ` John Prevost [this message]
2005-01-13 19:01 ` [Caml-list] " Will M. Farr
2005-01-13 20:24 ` John Prevost
2005-01-13 20:50 ` Erik de Castro Lopo
2005-01-13 21:32 ` Erik de Castro Lopo
2005-01-15 11:55 ` Xavier Leroy
2005-01-15 15:49 ` Michal Moskal
2005-01-15 17:01 ` [Caml-list] [FP performance] Ocaml sums the harmonic series Christophe TROESTLER
2005-01-15 17:13 ` [Caml-list] Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance Yaron Minsky
2005-01-23 2:27 ` Oliver Bandel
2005-01-23 6:07 ` Will M. Farr
2005-01-23 15:18 ` Oliver Bandel
2005-01-16 9:57 Philippe Lelédy
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=d849ad2a05011309291f121d61@mail.gmail.com \
--to=j.prevost@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=farr@mit.edu \
--cc=shootout-list@lists.alioth.debian.org \
/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