[commit: packages/containers] ghc-head: Add fromList with keys in descending order. (3bb336f)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 13:33:52 CEST 2013


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

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/containers.git;a=commit;h=3bb336f2ca9dcd408e245e28d2a55b75df8636fa

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

commit 3bb336f2ca9dcd408e245e28d2a55b75df8636fa
Author: Milan Straka <fox at ucw.cz>
Date:   Fri Aug 31 00:19:03 2012 +0200

    Add fromList with keys in descending order.
    
    Used to compare fromList on ordered and unordered inputs, as
    a linear-time algorithm is used in former case.


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

3bb336f2ca9dcd408e245e28d2a55b75df8636fa
 benchmarks/Map.hs |    1 +
 benchmarks/Set.hs |    1 +
 2 files changed, 2 insertions(+)

diff --git a/benchmarks/Map.hs b/benchmarks/Map.hs
index 5b4cf92..d0d539a 100644
--- a/benchmarks/Map.hs
+++ b/benchmarks/Map.hs
@@ -59,6 +59,7 @@ main = do
         , bench "intersection" $ whnf (M.intersection m) m_even
         , bench "split" $ whnf (M.split (bound `div` 2)) m
         , bench "fromList" $ whnf M.fromList elems
+        , bench "fromList-desc" $ whnf M.fromList (reverse elems)
         , bench "fromAscList" $ whnf M.fromAscList elems
         , bench "fromDistinctAscList" $ whnf M.fromDistinctAscList elems
         ]
diff --git a/benchmarks/Set.hs b/benchmarks/Set.hs
index 8880869..e21001c 100644
--- a/benchmarks/Set.hs
+++ b/benchmarks/Set.hs
@@ -34,6 +34,7 @@ main = do
         , bench "difference" $ whnf (S.difference s) s_even
         , bench "intersection" $ whnf (S.intersection s) s_even
         , bench "fromList" $ whnf S.fromList elems
+        , bench "fromList-desc" $ whnf S.fromList (reverse elems)
         , bench "fromAscList" $ whnf S.fromAscList elems
         , bench "fromDistinctAscList" $ whnf S.fromDistinctAscList elems
         ]





More information about the ghc-commits mailing list