@@ -21,6 +21,7 @@ import qualified Data.Text as T
2121import qualified Data.Text.Lazy as LT
2222import qualified Data.Text.Lazy.Builder as LTB
2323import qualified Data.Text.Lazy.Builder.Int as Int
24+import Data.Int (Int64)
2425
2526benchmark :: IO Benchmark
2627benchmark = return $ bgroup "Builder"
@@ -38,17 +39,22 @@ benchmark = return $ bgroup "Builder"
3839 [ bgroup "Decimal"
3940 [ bgroup "Positive" .
4041 flip map numbers $ \n ->
41− (bench (show n) $ nf (LTB.toLazyText . Int.decimal) n)
42+ (bench (show (length (show n))) $ nf (LTB.toLazyText . Int.decimal) n)
4243 , bgroup "Negative" .
4344 flip map numbers $ \m ->
4445 let n = negate m in
45− (bench (show n) $ nf (LTB.toLazyText . Int.decimal) n)
46+ (bench (show (length (show n))) $ nf (LTB.toLazyText . Int.decimal) n)
4647 ]
4748 ]
4849 ]
4950 where
50− numbers = [6,1,14,93,500,415,9688,2865,10654,30214,795659,829056,6207351,
51− 5608880,33929478,96076286,370106126,731223504] :: [Int]
51+ numbers :: [Int64]
52+ numbers = [
53+ 6, 14, 500, 9688, 10654, 620735, 5608880, 37010612,
54+ 731223504, 5061580596, 24596952933, 711732309084, 2845910093839,
55+ 54601756118340, 735159434806159, 3619097625502435, 95777227510267124,
56+ 414944309510675693, 8986407456998704019
57+ ]
5258
5359texts :: [T.Text]
5460texts = take 200000 $ cycle ["foo", "λx", "由の"]