[commit: packages/binary] master: Add Double to Put benchmark. (69d6ebf)

git at git.haskell.org git at git.haskell.org
Tue Apr 19 20:30:54 UTC 2016


Repository : ssh://git@git.haskell.org/binary

On branch  : master
Link       : http://git.haskell.org/packages/binary.git/commitdiff/69d6ebf0ead131fad0f22d441c0eac4989e45b84

>---------------------------------------------------------------

commit 69d6ebf0ead131fad0f22d441c0eac4989e45b84
Author: Lennart Kolmodin <kolmodin at gmail.com>
Date:   Sat Apr 16 23:44:53 2016 +0200

    Add Double to Put benchmark.


>---------------------------------------------------------------

69d6ebf0ead131fad0f22d441c0eac4989e45b84
 benchmarks/Put.hs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs
index 3d482eb..55ee5bd 100644
--- a/benchmarks/Put.hs
+++ b/benchmarks/Put.hs
@@ -29,7 +29,11 @@ main = do
     , rnf smallIntegers
     , rnf smallByteStrings
     , rnf smallStrings
+    , rnf doubles
     , rnf word8s
+    , rnf word16s
+    , rnf word32s
+    , rnf word64s
     ]
   defaultMain
     [
@@ -45,6 +49,8 @@ main = do
       bench "small Strings" $ whnf (run . fromStrings) smallStrings,
       bench "[small String]" $ whnf (run . put) smallStrings,
 
+      bench "Double" $ whnf (run . put) doubles,
+
       bench "Word8s monoid put" $ whnf (run . fromWord8s) word8s,
       bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s,
       bench "[Word8]" $ whnf (run . put) word8s,
@@ -105,6 +111,9 @@ smallStrings :: [String]
 smallStrings = replicate 10000 "abcdefghi"
 {-# NOINLINE smallStrings #-}
 
+doubles :: [Double]
+doubles = take 10000 $ [ sign * 2 ** n | sign <- [-1, 1], n <- [ 0, 0.2 .. 1023 ]]
+
 word8s :: [Word8]
 word8s = take 10000 $ cycle [minBound .. maxBound]
 {-# NOINLINE word8s #-}



More information about the ghc-commits mailing list