Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
ICFP'00 programming contest
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-09-07 (13:29)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: ICFP'00 programming contest
> It would be interesting to see how good ocaml is now with FP.
> I believe Fortran is king, with C being roughly 50% slower.

I have few numerical benchmarks in Caml, and even fewer for which
equivalent C code is available.  Here are figures for two such
benchmarks, Pseudoknot (an ADN conformation thing with lots of 3D
geometry) and FFT (fast Fourier transform):

                C          OCamlopt      OCamlopt
                        w. bounds checks wo. bounds checks

PentiumIII 450Mhz

FFT             0.43s       0.62s        0.55s
Nucleic         0.12s       0.17s        0.17s

Alpha 21264 500Mhz

FFT             0.28s       0.27s        0.26s
Nucleic         0.06s       0.07s        0.07s

So, OCaml is doing quite well on code that uses records of floats and
one-dimensional float arrays.  I don't have good benchmarks for
multidimensional arrays, but I'd expect the results to be not as good,
since the default representation of multidimensional arrays as arrays
of arrays can be expensive; however, the new "Bigarray" module
provides flat multidimensional float arrays, with some support in
ocamlopt to generate decent (if not really optimized) code.

> I'm not a numerical programmer, but I have considerable 'sympathy'
> for that art form, so I'd like to thank the ocaml team for the
> hard work of tuning ocaml to make it suitable for numerical
> programming use.

I, too, have sympathy for numerical applications, and we have very
interesting feedback from some members of this community.  They seem
quite open towards high-level languages with a mathematical flavor,
probably more so than most IT professionals.

In the same vein, you could have a look at the PSCICO project at CMU

- Xavier Leroy