Haskell performance

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Thu Mar 18 09:33:19 EST 2004


> I would recommend Haskell for speed of
> development and correctness of implementation, but (probably) C for
> speed.  You can of course combine the two with the FFI, but I don't
> know how trivial it is to pass Haskell graph structures to C and
> back.

If you use a C library for speed, you want to design the junction so that you 
make relatively few calls across the border and pass only a small amount of 
data across the border.  For example, if manipulating bitmaps, you would try 
to keep the bitmap object in the C world rather than copying it back and 
forth between C at every step.

A nice property of this kind of interface is that you wouldn't have a Haskell 
graph structure to pass back and forth - the graph would live entirely in C.

The only real complication you'll run into is that you'll probably need to use 
ForeignObj(ects) so that the graph objects can be released when the Haskell 
garbage collector finds it can't access them from the Haskell heap.  Not 
really hard to do - just need to be careful.

--
Alastair Reid


More information about the Glasgow-haskell-users mailing list