Skip to content

Commit 969ec2a

Browse files
author
Jaro Reinders
committed
Expand packing benchmarks
1 parent 12a6069 commit 969ec2a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

bench/BenchAll.hs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,18 @@ main = do
482482
[ bench "lazy" $ nf L8.unlines (map (L8.pack . show) intData)
483483
, bench "strict" $ nf S8.unlines (map (S8.pack . show) intData)
484484
]
485-
, bench "pack" $ nf S.pack (fromIntegral <$> intData)
486-
, bench "unsafePackLenBytes" $ nf (SI.unsafePackLenBytes nRepl) (fromIntegral <$> intData)
487-
, bench "unsafePackLenChars" $ nf (SI.unsafePackLenChars nRepl) (take nRepl (cycle ['\0'..'\255']))
485+
, bgroup "pack"
486+
[ bench "not fused" $ nf S.pack (replicate nRepl 0)
487+
, bench "fused" $ nf (S.pack . replicate nRepl) 0
488+
]
489+
, bgroup "unsafePackLenBytes"
490+
[ bench "not fused" $ nf (SI.unsafePackLenBytes nRepl) (replicate nRepl 0)
491+
, bench "fused" $ nf (SI.unsafePackLenBytes nRepl . replicate nRepl) 0
492+
]
493+
, bgroup "unsafePackLenChar"
494+
[ bench "not fused" $ nf (SI.unsafePackLenChars nRepl) (replicate nRepl 'A')
495+
, bench "fused" $ nf (SI.unsafePackLenChars nRepl . replicate nRepl) 'A'
496+
]
488497
, benchBoundsCheckFusion
489498
, benchCount
490499
, benchCSV

0 commit comments

Comments
 (0)