[Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Jun 21 00:48:53 EDT 2007


On Thu, 2007-06-21 at 08:14 +0400, Bulat Ziganshin wrote:
> Hello Duncan,
> 
> Thursday, June 21, 2007, 7:36:13 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).

Duncan



More information about the Haskell-Cafe mailing list