[Haskell-cafe] Performance: MD5

Andrew Coppin andrewcoppin at btinternet.com
Sun May 18 08:05:17 EDT 2008

Bulat Ziganshin wrote:
> Hello Andrew,
> Sunday, May 18, 2008, 3:42:23 PM, you wrote:
>> How much do you want to bet that the C version just reads a chunk of
>> data into RAM and then does a simple type-cast? (If I'm not very much 
>> mistaken, in C a type-cast is an O(0) operation.)
> try unsafeCoerce# for that.

Yeah, I might end up being forced to do that. [Although obviously it'll 
break on big-endian architectures.]

> or just use hGetArray to read directly into array of type you need

hGetArray :: Handle -> IOUArray Int Word8 -> Int -> IO Int

(But yeah, I can coerce it afterwards.)

More information about the Haskell-Cafe mailing list