[Haskell-cafe] Seven ways to store 16 bytes

2010-01-05 Thread Mark Lentczner
In preparing the speed ups in uuid-0.1.2, I investigated various ways to store 16 bytes of data in a Haskell object. Surprisingly, storing as 4 Word32 values in a standard data type worked best for that application. I've extracted out the testing work for that and put it here:

Re: [Haskell-cafe] Seven ways to store 16 bytes

2010-01-05 Thread Felipe Lessa
On Tue, Jan 05, 2010 at 04:06:09PM -0800, Mark Lentczner wrote: In preparing the speed ups in uuid-0.1.2, I investigated various ways to store 16 bytes of data in a Haskell object. Surprisingly, storing as 4 Word32 values in a standard data type worked best for that application. However, on

Re: [Haskell-cafe] Seven ways to store 16 bytes

2010-01-05 Thread Bryan O'Sullivan
2010/1/5 Mark Lentczner ma...@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

Re: [Haskell-cafe] Seven ways to store 16 bytes

2010-01-05 Thread Felipe Lessa
On Tue, Jan 05, 2010 at 04:40:55PM -0800, Bryan O'Sullivan wrote: 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? I've