[Haskell-cafe] Seven ways to store 16 bytes
Felipe Lessa
felipe.lessa at gmail.com
Tue Jan 5 19:36:27 EST 2010
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 an Core 2 Duo in x86-64 mode with GHC 6.10, 2 Word64
values wins over 4 Word32 values. Attached is the modified
source code. Here is the summary between them
equal-itself/words 76.41 ns
equal-itself/words64 64.52 ns
equal-same/words 79.64 ns
equal-same/words64 67.85 ns
equal-differ/words 66.11 ns
equal-differ/words64 62.79 ns
compare-same/words 80.59 ns
compare-same/words64 68.68 ns
compare-differ/words 67.14 ns
compare-differ/words64 64.22 ns
toList-and-sum/words 991.32 ns
toList-and-sum/words64 839.45 ns
map-and-sum/words 1.04 us
map-and-sum/words64 1.12 us
fold-and-sum/words 882.88 ns
fold-and-sum/words64 755.98 ns
fromList-and-eq/words 740.41 ns
fromList-and-eq/words64 749.07 ns
build-and-eq/words 484.54 ns
build-and-eq/words64 447.81 ns
unfold-and-eq/words 577.12 ns
unfold-and-eq/words64 541.46 ns
Cheers,
--
Felipe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SixteenBytes.hs
Type: text/x-haskell
Size: 12452 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100105/e26aee96/SixteenBytes.bin
More information about the Haskell-Cafe
mailing list