From: "Will M. Farr" <farr@MIT.EDU>
To: John Prevost <j.prevost@gmail.com>
Cc: caml-list@yquem.inria.fr, shootout-list@lists.alioth.debian.org
Subject: Re: [Caml-list] Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance
Date: Thu, 13 Jan 2005 14:01:24 -0500 [thread overview]
Message-ID: <850815AC-6595-11D9-A551-000393A34E82@mit.edu> (raw)
In-Reply-To: <d849ad2a05011309291f121d61@mail.gmail.com>
Is the PowerPC ocamlopt back-end less optimized than the x86? I didn't
realize that ocamlopt did enough optimizations that the backend would
be substantially different on the different architectures (in the
manual they say that it compiles the code essentially as written -- no
loop unrolling, etc). Are you sure that there isn't just a built-in
instruction on the x86 that adds an int to a float?
Will
On 13 Jan 2005, at 12:29 PM, John Prevost wrote:
> 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 19:01 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 ` [Caml-list] " John Prevost
2005-01-13 19:01 ` Will M. Farr [this message]
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=850815AC-6595-11D9-A551-000393A34E82@mit.edu \
--to=farr@mit.edu \
--cc=caml-list@yquem.inria.fr \
--cc=j.prevost@gmail.com \
--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