[Haskell-cafe] Re: OCaml list sees abysmalLanguage Shootoutresults

MR K P SCHUPKE k.schupke at imperial.ac.uk
Fri Oct 8 12:19:05 EDT 2004

>  - take this further and have list cells with 2 (or more) unboxed
>    characters, or even a full buffer.

This sounds like the best idea to me... with each list cell being a
full buffer you could effectively write nieve [Char] code and have it
implemented in about as fast a way as possible...

A little improvement on this would be to do a bit of read ahead, so
that the filesystem latency can be hidden. (ie one thread reads the
next buffer, whilst the application thread processes the previous

This would also benefit string processing... Imagine:

test = "aaaa" ++ "bbbb"

This could be implented as two list cells, one for each string, anf
the cost of the "++" becomes the same as the cost of ":"

test = 'a' : "bbbb"

could be implemented in exactly the same way (a cell of size one and
a cell of size 4)

In this way with the cell size dependant on the source, lists generated
by prepending characters would remain exactly as they are.

The only slight complexity would be allowing 'next' pointers to point
halfway through a cell, so that if you start with "dddd" remove the
first character and prepend 'c' the original list "dddd" could still
be in scope.


More information about the Haskell-Cafe mailing list