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
53
53
, bench " spanAntitone" $ whnf (M. spanAntitone (< key_mid)) m
54
54
, bench " split" $ whnf (M. split key_mid) m
55
55
, bench " splitLookup" $ whnf (M. splitLookup key_mid) m
56
+ , bench " eq" $ whnf (\ m' -> m' == m') m -- worst case, compares everything
56
57
]
57
58
where
58
59
elems = elems_hits
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ main = do
56
56
, bench " split:sparse" $ whnf (IS. split elem_sparse_mid) s_sparse
57
57
, bench " splitMember:dense" $ whnf (IS. splitMember elem_mid) s
58
58
, bench " splitMember:sparse" $ whnf (IS. splitMember elem_sparse_mid) s_sparse
59
+ , bench " eq" $ whnf (\ s' -> s' == s') s -- worst case, compares everything
59
60
]
60
61
where
61
62
bound = 2 ^ 12
Original file line number Diff line number Diff line change @@ -3433,8 +3433,7 @@ data Distinct = Distinct | Nondistinct
3433
3433
Eq
3434
3434
--------------------------------------------------------------------}
3435
3435
instance Eq a => Eq (IntMap a ) where
3436
- t1 == t2 = equal t1 t2
3437
- t1 /= t2 = nequal t1 t2
3436
+ (==) = equal
3438
3437
3439
3438
equal :: Eq a => IntMap a -> IntMap a -> Bool
3440
3439
equal (Bin p1 l1 r1) (Bin p2 l2 r2)
@@ -3443,14 +3442,7 @@ equal (Tip kx x) (Tip ky y)
3443
3442
= (kx == ky) && (x== y)
3444
3443
equal Nil Nil = True
3445
3444
equal _ _ = 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 #-}
3454
3446
3455
3447
-- | @since 0.5.9
3456
3448
instance Eq1 IntMap where
Original file line number Diff line number Diff line change @@ -1410,8 +1410,7 @@ data Inserted = Inserted !IntSet ![Key]
1410
1410
Eq
1411
1411
--------------------------------------------------------------------}
1412
1412
instance Eq IntSet where
1413
- t1 == t2 = equal t1 t2
1414
- t1 /= t2 = nequal t1 t2
1413
+ (==) = equal
1415
1414
1416
1415
equal :: IntSet -> IntSet -> Bool
1417
1416
equal (Bin p1 l1 r1) (Bin p2 l2 r2)
@@ -1421,14 +1420,6 @@ equal (Tip kx1 bm1) (Tip kx2 bm2)
1421
1420
equal Nil Nil = True
1422
1421
equal _ _ = False
1423
1422
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
-
1432
1423
{- -------------------------------------------------------------------
1433
1424
Ord
1434
1425
--------------------------------------------------------------------}
You can’t perform that action at this time.
0 commit comments