[commit: packages/containers] zip-devel: Add simple fromFunction benchmark. (fc87eee)

git at git.haskell.org git at git.haskell.org
Sun Dec 20 16:22:19 UTC 2015


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

On branch  : zip-devel
Link       : http://git.haskell.org/packages/containers.git/commitdiff/fc87eeefa5907559b2669a16baed03db79f82981

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

commit fc87eeefa5907559b2669a16baed03db79f82981
Author: Milan Straka <fox at ucw.cz>
Date:   Sun Dec 7 14:57:24 2014 +0100

    Add simple fromFunction benchmark.


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

fc87eeefa5907559b2669a16baed03db79f82981
 benchmarks/Sequence.hs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs
index ccaca6c..58e1114 100644
--- a/benchmarks/Sequence.hs
+++ b/benchmarks/Sequence.hs
@@ -29,7 +29,13 @@ main = do
          [ 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 ())
-         ] ]
+         ]
+      , bgroup "fromFunction"
+         [ bench "ix10000/5000" $ nf (\size -> S.fromFunction size id `S.index` (size `div` 2)) 10000
+         , bench "nf100" $ nf (\size -> S.fromFunction size id) 100
+         , bench "nf10000" $ nf (\size -> S.fromFunction size id) 10000
+         ]
+      ]
 
 -- splitAt+append: repeatedly cut the sequence at a random point
 -- and rejoin the pieces in the opposite order.



More information about the ghc-commits mailing list