[Gllug] OSS CMSs
Nix
nix at esperi.org.uk
Fri May 13 15:03:28 UTC 2005
On Fri, 13 May 2005, Richard Jones suggested tentatively:
> On Fri, May 13, 2005 at 11:43:50AM +0100, Tim Towers wrote:
>> The context colouring of the OCaml didnt seem a fair presentation compared
>> to the plain C++. Also, are doubles in C++ the same size as floats on OCaml?
>> That could explain the difference in relative speeds between the 32bit and
>> 64 bit platforms as shown on the web page.
>
> Yes, float in OCaml is a double in C (8 bytes).
That was a good decision: double is a native type on more platforms than
is float. (i386-type CPUs have neither as native types: they're horrible
for floating point.)
Compiling with -ffast-math would have pushed things a little further towards
speed :)
>> Optimisation brought the C++ runtime down from 129 seconds to 49.
>> Optimisation improved the ocaml version down from 49 to 30 seconds.
>
> It's definitely possible to optimise C and C++ programs so that
> they're faster than OCaml programs.
... however, a sufficiently clever OCaml compiler can carry out
optimizations that are... impractical in C. Curry is probably an even
more extreme example, where the compiler is often seen to decide that it
dislikes the algorithm you employed and replace it with something
equivalent which has better time and/or space complexity :)
--
`End users are just test loads for verifying that the system works, kind of
like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list