@@ -17,9 +17,12 @@ import Data.Text.Fusion.Internal (Step (..), Stream (..))
1717import qualified Data.Text.Encoding as T
1818import qualified Data.Text.Encoding.Error as E
1919import qualified Data.Text.Encoding.Fusion as T
20+import qualified Data.Text.Encoding.Fusion.Common as F
21+import qualified Data.Text.Fusion as T
2022import qualified Data.Text.IO as T
2123import qualified Data.Text.Lazy.Encoding as TL
2224import qualified Data.Text.Lazy.Encoding.Fusion as TL
25+import qualified Data.Text.Lazy.Fusion as TL
2326import qualified Data.Text.Lazy.IO as TL
2427
2528instance NFData a => NFData (Stream a) where
@@ -49,8 +52,19 @@ benchmark fp = do
4952 !utf32leL = TL.encodeUtf32LE tl
5053 !utf32beL = TL.encodeUtf32BE tl
5154
55+ -- For the functions which operate on streams
56+ let !s = T.stream t
57+
5258 return $ bgroup "Stream"
53− [ bgroup "streamUtf8"
59+
60+ -- Fusion
61+ [ bgroup "stream" $
62+ [ bench "Text" $ nf T.stream t
63+ , bench "LazyText" $ nf TL.stream tl
64+ ]
65+
66+ -- Encoding.Fusion
67+ , bgroup "streamUtf8"
5468 [ bench "Text" $ nf (T.streamUtf8 E.lenientDecode) utf8
5569 , bench "LazyText" $ nf (TL.streamUtf8 E.lenientDecode) utf8L
5670 ]
@@ -70,4 +84,11 @@ benchmark fp = do
7084 [ bench "Text" $ nf (T.streamUtf32BE E.lenientDecode) utf32be
7185 , bench "LazyText" $ nf (TL.streamUtf32BE E.lenientDecode) utf32beL
7286 ]
87+
88+ -- Encoding.Fusion.Common
89+ , bench "restreamUtf8" $ nf F.restreamUtf8 s
90+ , bench "restreamUtf16LE" $ nf F.restreamUtf16LE s
91+ , bench "restreamUtf16BE" $ nf F.restreamUtf16BE s
92+ , bench "restreamUtf32LE" $ nf F.restreamUtf32LE s
93+ , bench "restreamUtf32BE" $ nf F.restreamUtf32BE s
7394 ]