on master help sign in
Benchmark intersperse and intercalate.
cd6f8afBryan O'Sullivan
tests/Benchmarks.hs+23−1
@@ -134,6 +134,13 @@ main = do
134 , bench "bl" $ nf (BL.intercalate blw) bll
134 , bench "bl" $ nf (BL.intercalate blw) bll
135 , bench "l" $ nf (L.intercalate lw) ll
135 , bench "l" $ nf (L.intercalate lw) ll
136 ],
136 ],
137+ bgroup "intersperse" [
138+ bench "ts" $ nf (TS.intersperse c) tsa
139+ , bench "tl" $ nf (TL.intersperse c) tla
140+ , bench "bs" $ nf (BS.intersperse c) bsa
141+ , bench "bl" $ nf (BL.intersperse c) bla
142+ , bench "l" $ nf (L.intersperse c) la
143+ ],
137 bgroup "isInfixOf" [
144 bgroup "isInfixOf" [
138 bench "ts" $ nf (TS.isInfixOf tsw) tsa
145 bench "ts" $ nf (TS.isInfixOf tsw) tsa
139 , bench "tl" $ nf (TL.isInfixOf tlw) tla
146 , bench "tl" $ nf (TL.isInfixOf tlw) tla
@@ -219,6 +226,20 @@ main = do
219 , bench "bl" $ nf (BL.length . BL.filter p1 . BL.filter p0) bla
226 , bench "bl" $ nf (BL.length . BL.filter p1 . BL.filter p0) bla
220 , bench "l" $ nf (L.length . L.filter p1 . L.filter p0) la
227 , bench "l" $ nf (L.length . L.filter p1 . L.filter p0) la
221 ],
228 ],
229+ bgroup "intercalate" [
230+ bench "ts" $ nf (TS.length . TS.intercalate tsw) tsl
231+ , bench "tl" $ nf (TL.length . TL.intercalate tlw) tll
232+ , bench "bs" $ nf (BS.length . BS.intercalate bsw) bsl
233+ , bench "bl" $ nf (BL.length . BL.intercalate blw) bll
234+ , bench "l" $ nf (L.length . L.intercalate lw) ll
235+ ],
236+ bgroup "intersperse" [
237+ bench "ts" $ nf (TS.length . TS.intersperse c) tsa
238+ , bench "tl" $ nf (TL.length . TL.intersperse c) tla
239+ , bench "bs" $ nf (BS.length . BS.intersperse c) bsa
240+ , bench "bl" $ nf (BL.length . BL.intersperse c) bla
241+ , bench "l" $ nf (L.length . L.intersperse c) la
242+ ],
222 bgroup "map" [
243 bgroup "map" [
223 bench "ts" $ nf (TS.length . TS.map f) tsa
244 bench "ts" $ nf (TS.length . TS.map f) tsa
224 , bench "tl" $ nf (TL.length . TL.map f) tla
245 , bench "tl" $ nf (TL.length . TL.map f) tla
@@ -256,7 +277,8 @@ main = do
256 ]
277 ]
257 ]
278 ]
258 where
279 where
280+ c = 'й'
259− p0 = (== 'й')
281+ p0 = (== c)
260 p1 = (/= 'д')
282 p1 = (/= 'д')
261 lw = "право"
283 lw = "право"
262 bsw = UTF8.fromString lw
284 bsw = UTF8.fromString lw