[commit: packages/containers] master: update benchmarks to work with criterion-1.0 (5364bea)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 22:11:30 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/containers.git/commitdiff/5364beaa69609ba3c0868cec4380b9c36105b740

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

commit 5364beaa69609ba3c0868cec4380b9c36105b740
Author: Bertram Felgenhauer <int-e at gmx.de>
Date:   Mon Dec 22 17:08:21 2014 +0100

    update benchmarks to work with criterion-1.0


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

5364beaa69609ba3c0868cec4380b9c36105b740
 benchmarks/IntMap.hs   | 6 ++----
 benchmarks/IntSet.hs   | 6 ++----
 benchmarks/Map.hs      | 6 ++----
 benchmarks/Sequence.hs | 7 ++++---
 benchmarks/Set.hs      | 6 ++----
 5 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/benchmarks/IntMap.hs b/benchmarks/IntMap.hs
index 87465a7..38104c0 100644
--- a/benchmarks/IntMap.hs
+++ b/benchmarks/IntMap.hs
@@ -4,7 +4,6 @@ module Main where
 import Control.DeepSeq
 import Control.Exception (evaluate)
 import Control.Monad.Trans (liftIO)
-import Criterion.Config
 import Criterion.Main
 import Data.List (foldl')
 import qualified Data.IntMap as M
@@ -13,9 +12,8 @@ import Prelude hiding (lookup)
 
 main = do
     let m = M.fromAscList elems :: M.IntMap Int
-    defaultMainWith
-        defaultConfig
-        (liftIO . evaluate $ rnf [m])
+    evaluate $ rnf [m]
+    defaultMain
         [ bench "lookup" $ whnf (lookup keys) m
         , bench "insert" $ whnf (ins elems) M.empty
         , bench "insertWith empty" $ whnf (insWith elems) M.empty
diff --git a/benchmarks/IntSet.hs b/benchmarks/IntSet.hs
index 7c16c91..a768a32 100644
--- a/benchmarks/IntSet.hs
+++ b/benchmarks/IntSet.hs
@@ -5,7 +5,6 @@ module Main where
 import Control.DeepSeq
 import Control.Exception (evaluate)
 import Control.Monad.Trans (liftIO)
-import Criterion.Config
 import Criterion.Main
 import Data.List (foldl')
 import qualified Data.IntSet as S
@@ -14,9 +13,8 @@ main = do
     let s = S.fromAscList elems :: S.IntSet
         s_even = S.fromAscList elems_even :: S.IntSet
         s_odd = S.fromAscList elems_odd :: S.IntSet
-    defaultMainWith
-        defaultConfig
-        (liftIO . evaluate $ rnf [s, s_even, s_odd])
+    evaluate $ rnf [s, s_even, s_odd]
+    defaultMain
         [ bench "member" $ whnf (member elems) s
         , bench "insert" $ whnf (ins elems) S.empty
         , bench "map" $ whnf (S.map (+ 1)) s
diff --git a/benchmarks/Map.hs b/benchmarks/Map.hs
index d0d539a..60e7ace 100644
--- a/benchmarks/Map.hs
+++ b/benchmarks/Map.hs
@@ -4,7 +4,6 @@ module Main where
 import Control.DeepSeq
 import Control.Exception (evaluate)
 import Control.Monad.Trans (liftIO)
-import Criterion.Config
 import Criterion.Main
 import Data.List (foldl')
 import qualified Data.Map as M
@@ -15,9 +14,8 @@ main = do
     let m = M.fromAscList elems :: M.Map Int Int
         m_even = M.fromAscList elems_even :: M.Map Int Int
         m_odd = M.fromAscList elems_odd :: M.Map Int Int
-    defaultMainWith
-        defaultConfig
-        (liftIO . evaluate $ rnf [m, m_even, m_odd])
+    evaluate $ rnf [m, m_even, m_odd]
+    defaultMain
         [ bench "lookup absent" $ whnf (lookup evens) m_odd
         , bench "lookup present" $ whnf (lookup evens) m_even
         , bench "insert absent" $ whnf (ins elems_even) m_odd
diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs
index a152c3b..7ccede9 100644
--- a/benchmarks/Sequence.hs
+++ b/benchmarks/Sequence.hs
@@ -3,6 +3,7 @@ module Main where
 
 import Control.Applicative
 import Control.DeepSeq
+import Control.Exception (evaluate)
 import Criterion.Main
 import Data.List (foldl')
 import qualified Data.Sequence as S
@@ -14,19 +15,19 @@ main = do
         s100 = S.fromList [1..100] :: S.Seq Int
         s1000 = S.fromList [1..1000] :: S.Seq Int
         s10000 = S.fromList [1..10000] :: S.Seq Int
-    rnf [s10, s100, s1000, s10000] `seq` return ()
+    evaluate $ rnf [s10, s100, s1000, s10000]
     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
         r10000 = rlist 10000
-    rnf [r10, r100, r1000, r10000] `seq` return ()
+    evaluate $ rnf [r10, r100, r1000, r10000]
     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 ()
+    evaluate $ rnf [u10, u100, u1000, u10000]
     defaultMain
       [ bgroup "splitAt/append"
          [ bench "10" $ nf (shuffle r10) s10
diff --git a/benchmarks/Set.hs b/benchmarks/Set.hs
index e21001c..3a6e8aa 100644
--- a/benchmarks/Set.hs
+++ b/benchmarks/Set.hs
@@ -6,7 +6,6 @@ module Main where
 import Control.DeepSeq
 import Control.Exception (evaluate)
 import Control.Monad.Trans (liftIO)
-import Criterion.Config
 import Criterion.Main
 import Data.List (foldl')
 import qualified Data.Set as S
@@ -15,9 +14,8 @@ main = do
     let s = S.fromAscList elems :: S.Set Int
         s_even = S.fromAscList elems_even :: S.Set Int
         s_odd = S.fromAscList elems_odd :: S.Set Int
-    defaultMainWith
-        defaultConfig
-        (liftIO . evaluate $ rnf [s, s_even, s_odd])
+    evaluate $ rnf [s, s_even, s_odd]
+    defaultMain
         [ bench "member" $ whnf (member elems) s
         , bench "insert" $ whnf (ins elems) S.empty
         , bench "map" $ whnf (S.map (+ 1)) s



More information about the ghc-commits mailing list