[Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Jun 22 02:52:19 EDT 2007

Hello Duncan,

Thursday, June 21, 2007, 8:48:53 AM, you wrote:

>> > The smallest possible would be 2 words overhead by just using a
>> > ByteArray#,
>> i tried it once and found that ByteArray# size is returned rounded to 4 -
>> there is no way in GHC runtime to alloc, say, exactly 37 bytes. and
>> don't forget to add 2 unused bytes at average

> Right, GHC heap object are always aligned to the natural alignment of
> the architecture, be that 4 or 8 bytes.

> Try the same experiment with C's malloc. I'd be very surprised if you
> can allocate 37 bytes and not end up using 40 (plus some extra for
> remembering the allocation length).

that i'm trying to say is that one need to store exact string size
because value returned by getSizeOfByteArray is aligned to 4

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list