[Haskell-cafe] Toy compression algorithms [was: A very edgy language]

Andrew Coppin andrewcoppin at btinternet.com
Sun Jul 8 11:12:38 EDT 2007

Stefan O'Rear wrote:
> On Sun, Jul 08, 2007 at 12:10:04PM +0100, Andrew Coppin wrote:
>> (Realistically though. My program takes a [Word8] and turns it into a 
>> [Bool] before running a parser over it. The GHC optimiser doesn't really 
>> stand a hope in hell of optimising that into a program that reads a machine 
>> word into a CPU register and starts playing with bit flips on it...)
> Actually, if you're very lucky (fusion is just as hard in Haskell as it
> is in real life), it *does*.  It seems to fit nicely into the
> stream-fusion framework.

Ooo... really? That's pretty impressive...(!)

Is there a way I can check? ;-) More usefully, can I do stuff to my code 
to make myself more "lucky"?

(Love the comment about RL BTW!)

>> PS. Are those zlib libraries actually written in Haskell? Or are they a 
>> thin layer on top of a C library?
> Yup, they wrap C's zlib.

Thought so. Comparing native Haskell to a heavily optimised C library 
would surely be just like comparing native Haskell to a compiled C binary...

>> PPS. Does GHC make use of MMX, SSE, et al?
> No (in spirit - the native code generator uses 1-element SSE operations
> for floating point because it's easier to optimize than "FPU" code).

Does GHC actually do anything that could usefully use these primitives? 
(I'm guessing "no"...)

More information about the Haskell-Cafe mailing list