on master help sign in
See how fused comparisons fare.
a44db71Bryan O'Sullivan
tests/benchmarks/Ordering.hs+4
@@ -17,6 +17,10 @@ func :: (Ord a) => [a] -> IO ()
17func ls = print . sum . map f $ every 1000 ls
17func ls = print . sum . map f $ every 1000 ls
18 where f needle = length . filter ((==GT) . compare needle) $ ls
18 where f needle = length . filter ((==GT) . compare needle) $ ls
19
19
20+-- Test a comparison that could be fused: compare (toLower a) (toLower b)
21+func1 ls = print . sum . map f $ every 1000 ls
22+ where f needle = length . filter ((==GT) . compare (T.toLower needle) . T.toLower) $ ls
23+
20bytestring haystack = func =<< B.lines `fmap` B.readFile haystack
24bytestring haystack = func =<< B.lines `fmap` B.readFile haystack
21
25
22lazyBytestring haystack = func =<< BL.lines `fmap` BL.readFile haystack
26lazyBytestring haystack = func =<< BL.lines `fmap` BL.readFile haystack