Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <j.prevost@g...>
Subject: Re: [Caml-list] Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance
There quite possibly is--I could look.  But I do believe that the
Intel architecture is best optimized for at least some set of
operations.  For example, looking through the assembly source, you'll
notice that it sometimes abuses Intel addressing modes to reduce the
cost of "Caml ints are just like native ints with a 1 in the low bit".

As for whether there's a quick "convert int to float" call in Intel, I
really have no idea.  The assembly for the simple function:

let test x = float_of_int x

isn't trivial, however.  I have to admit that I don't know the ins and
outs of Intel assembly any further than I have learned them while
trying to optimize specific O'Caml loops.  And since I rarely use
floating point, all of these opcodes are greek to me.  :)  I *think*
it's allocating space in the heap for the float, then filling it in
with a non-normalized value (which is pretty easy, since doubles are
64 bits, and ints are 31 bits), and then saying "normalize this,
please."  But I can't say for sure.  And since I don't have a PPC
system to play with, I can't compare.

John.