[commit: packages/containers] develop-0.6, develop-0.6-questionable, master: Use pre-evaluated sequences in benchmarks. (999851e)

git at git.haskell.org git at git.haskell.org
Fri Jan 23 22:42:17 UTC 2015


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

On branches: develop-0.6,develop-0.6-questionable,master
Link       : http://git.haskell.org/packages/containers.git/commitdiff/999851e33acde2db08b06cf8d0331f37bbeb3c0b

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

commit 999851e33acde2db08b06cf8d0331f37bbeb3c0b
Author: Milan Straka <fox at ucw.cz>
Date:   Sun Dec 14 16:26:42 2014 +0100

    Use pre-evaluated sequences in benchmarks.


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

999851e33acde2db08b06cf8d0331f37bbeb3c0b
 benchmarks/Sequence.hs | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs
index ccaca6c..8fd1fcf 100644
--- a/benchmarks/Sequence.hs
+++ b/benchmarks/Sequence.hs
@@ -12,13 +12,20 @@ main = do
     let s10 = S.fromList [1..10] :: S.Seq Int
         s100 = S.fromList [1..100] :: S.Seq Int
         s1000 = S.fromList [1..1000] :: S.Seq Int
-    rnf [s10, s100, s1000] `seq` return ()
+        s10000 = S.fromList [1..10000] :: S.Seq Int
+    rnf [s10, s100, s1000, s10000] `seq` return ()
     let g = mkStdGen 1
     let rlist n = map (`mod` (n+1)) (take 10000 (randoms g)) :: [Int]
         r10 = rlist 10
         r100 = rlist 100
         r1000 = rlist 1000
-    rnf [r10, r100, r1000] `seq` return ()
+        r10000 = rlist 10000
+    rnf [r10, r100, r1000, r10000] `seq` return ()
+    let u10 = S.replicate 10 () :: S.Seq ()
+        u100 = S.replicate 100 () :: S.Seq ()
+        u1000 = S.replicate 1000 () :: S.Seq ()
+        u10000 = S.replicate 10000 () :: S.Seq ()
+    rnf [u10, u100, u1000, u10000] `seq` return ()
     defaultMain
       [ bgroup "splitAt/append"
          [ bench "10" $ nf (shuffle r10) s10
@@ -26,9 +33,9 @@ main = do
          , bench "1000" $ nf (shuffle r1000) s1000
          ]
       , bgroup "zip"
-         [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (S.replicate 10000 (), S.fromList [1..10000::Int])
-         , bench "nf150" $ nf (uncurry S.zip) (S.fromList [1..150::Int], S.replicate 150 ())
-         , bench "nf10000" $ nf (uncurry S.zip) (S.fromList [1..10000::Int], S.replicate 10000 ())
+         [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (s10000, u10000)
+         , bench "nf100" $ nf (uncurry S.zip) (s100, u100)
+         , bench "nf10000" $ nf (uncurry S.zip) (s10000, u10000)
          ] ]
 
 -- splitAt+append: repeatedly cut the sequence at a random point



More information about the ghc-commits mailing list