Add fromList with keys in descending order.
authorMilan Straka <fox@ucw.cz>
Thu, 30 Aug 2012 22:19:03 +0000 (00:19 +0200)
committerMilan Straka <fox@ucw.cz>
Thu, 30 Aug 2012 22:19:03 +0000 (00:19 +0200)
Used to compare fromList on ordered and unordered inputs, as
a linear-time algorithm is used in former case.

benchmarks/Map.hs
benchmarks/Set.hs

index 5b4cf92..d0d539a 100644 (file)
@@ -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
         ]
index 8880869..e21001c 100644 (file)
@@ -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
         ]