[Haskell-cafe] Seven ways to store 16 bytes

Bryan O'Sullivan bos at serpentine.com
Tue Jan 5 19:40:55 EST 2010


2010/1/5 Mark Lentczner <markl at glyphic.com>

> There you can find the code that tests storing 16 bytes in various ways:
>
> > data InWords = WO !Word32 !Word32 !Word32 !Word32
> >     deriving (Eq, Ord)
> >
> > data InList       = LI [Word8]              deriving (Eq, Ord)
> > data InByteString = BS B.ByteString         deriving (Eq, Ord)
> > data InArray      = AR (A.Array Int Word8)  deriving (Eq, Ord)
> > data InUArray     = UA (U.UArray Int Word8) deriving (Eq, Ord)
> > data InVector     = VE (V.UArr Word8)       deriving (Eq)


You've got an extra level of indirection there due to the use of data
instead of newtype, so you're paying an additional boxing penalty for
everything except your first case. Are you compiling with
-funbox-strict-fields?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100105/56661ed4/attachment.html


More information about the Haskell-Cafe mailing list