File tree Expand file tree Collapse file tree 4 files changed +5
-20
lines changed
containers-tests/benchmarks Expand file tree Collapse file tree 4 files changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ main = do
5353 , bench " spanAntitone" $ whnf (M. spanAntitone (< key_mid)) m
5454 , bench " split" $ whnf (M. split key_mid) m
5555 , bench " splitLookup" $ whnf (M. splitLookup key_mid) m
56+ , bench " eq" $ whnf (\ m' -> m' == m') m -- worst case, compares everything
5657 ]
5758 where
5859 elems = elems_hits
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ main = do
5656 , bench " split:sparse" $ whnf (IS. split elem_sparse_mid) s_sparse
5757 , bench " splitMember:dense" $ whnf (IS. splitMember elem_mid) s
5858 , bench " splitMember:sparse" $ whnf (IS. splitMember elem_sparse_mid) s_sparse
59+ , bench " eq" $ whnf (\ s' -> s' == s') s -- worst case, compares everything
5960 ]
6061 where
6162 bound = 2 ^ 12
Original file line number Diff line number Diff line change @@ -3433,8 +3433,7 @@ data Distinct = Distinct | Nondistinct
34333433 Eq
34343434--------------------------------------------------------------------}
34353435instance Eq a => Eq (IntMap a ) where
3436- t1 == t2 = equal t1 t2
3437- t1 /= t2 = nequal t1 t2
3436+ (==) = equal
34383437
34393438equal :: Eq a => IntMap a -> IntMap a -> Bool
34403439equal (Bin p1 l1 r1) (Bin p2 l2 r2)
@@ -3443,14 +3442,7 @@ equal (Tip kx x) (Tip ky y)
34433442 = (kx == ky) && (x== y)
34443443equal Nil Nil = True
34453444equal _ _ = False
3446-
3447- nequal :: Eq a => IntMap a -> IntMap a -> Bool
3448- nequal (Bin p1 l1 r1) (Bin p2 l2 r2)
3449- = (p1 /= p2) || (nequal l1 l2) || (nequal r1 r2)
3450- nequal (Tip kx x) (Tip ky y)
3451- = (kx /= ky) || (x/= y)
3452- nequal Nil Nil = False
3453- nequal _ _ = True
3445+ {-# INLINABLE equal #-}
34543446
34553447-- | @since 0.5.9
34563448instance Eq1 IntMap where
Original file line number Diff line number Diff line change @@ -1410,8 +1410,7 @@ data Inserted = Inserted !IntSet ![Key]
14101410 Eq
14111411--------------------------------------------------------------------}
14121412instance Eq IntSet where
1413- t1 == t2 = equal t1 t2
1414- t1 /= t2 = nequal t1 t2
1413+ (==) = equal
14151414
14161415equal :: IntSet -> IntSet -> Bool
14171416equal (Bin p1 l1 r1) (Bin p2 l2 r2)
@@ -1421,14 +1420,6 @@ equal (Tip kx1 bm1) (Tip kx2 bm2)
14211420equal Nil Nil = True
14221421equal _ _ = False
14231422
1424- nequal :: IntSet -> IntSet -> Bool
1425- nequal (Bin p1 l1 r1) (Bin p2 l2 r2)
1426- = (p1 /= p2) || (nequal l1 l2) || (nequal r1 r2)
1427- nequal (Tip kx1 bm1) (Tip kx2 bm2)
1428- = kx1 /= kx2 || bm1 /= bm2
1429- nequal Nil Nil = False
1430- nequal _ _ = True
1431-
14321423{- -------------------------------------------------------------------
14331424 Ord
14341425--------------------------------------------------------------------}
You can’t perform that action at this time.
0 commit comments