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
OCaml image blending performance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-07 (15:08)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] OCaml image blending performance
On Thursday 07 February 2008 11:01:54 Richard Jones wrote:
> On Wed, Feb 06, 2008 at 11:34:02PM +0000, Jon Harrop wrote:
> > In this case, most of the speed loss can be regained by simply
> > aggressively inlining everything, which is exactly what you (ab)used
> > C macros for in the C code.
> I don't understand this.  In '' (which I was responsible for)
> C macros are used to inline all the OCaml functions the same as in the
> C version.  Yet it's still 70% slower than the C version.
> My suspicion was that it was to do with his use of a string as a byte
> array.

I suspect OCaml's 31-bit integers are responsible for the remaining slowdown. 
You might try using 32-bit integers (Int32) but I'm not sure ocamlopt will 
unbox them as aggressively as it does floats (I've never tried it).

Dr Jon D Harrop, Flying Frog Consultancy Ltd.