-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Here are the intersection benchmarks as of #406:
unordered-containers/benchmarks/Benchmarks.hs
Lines 322 to 325 in d24cc1f
| , bgroup "intersection" | |
| [ bench "Int" $ whnf (HM.intersection hmi) hmi2 | |
| , bench "ByteString" $ whnf (HM.intersection hmbs) hmbsSubset | |
| ] |
unordered-containers/benchmarks/Benchmarks.hs
Lines 84 to 88 in d24cc1f
| elemsBS = zip keysBS [1..n] | |
| keysBS = UBS.rnd 8 n | |
| elemsI = zip keysI [1..n] | |
| keysI = UI.rnd (n+n) n | |
| elemsI2 = zip [n `div` 2..n + (n `div` 2)] [1..n] -- for union |
unordered-containers/benchmarks/Benchmarks.hs
Lines 103 to 107 in d24cc1f
| hmbs = HM.fromList elemsBS | |
| hmbsSubset = HM.fromList (takeSubset n elemsBS) | |
| hmi = HM.fromList elemsI | |
| hmiSubset = HM.fromList (takeSubset n elemsI) | |
| hmi2 = HM.fromList elemsI2 |
unordered-containers/benchmarks/Benchmarks.hs
Lines 120 to 123 in d24cc1f
| takeSubset n elements = | |
| -- use 50% of the elements for a subset check. | |
| let subsetSize = round (fromIntegral n * 0.5 :: Double) :: Int | |
| in take subsetSize elements |
I think the maps in these benchmarks have an unusually large overlap – there are relatively few elements that do not lie in the intersection. It would be interesting to have benchmarks where the intersection is relatively smaller.
With such benchmarks it may also turn out that it is faster to iterate only over the intersections of the array nodes in intersectionArrayBy, as implemented in oberblastmeister@1ee67ea.