File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ char8 :: Char -> Builder
442442char8 = P. primFixed P. char8
443443
444444-- | Char8 encode a 'String'.
445- {-# INLINE [1] string8 #-} -- phased to allow literal cstring rewrites
445+ {-# NOINLINE string8 #-}
446446string8 :: String -> Builder
447447string8 = P. primMapListFixed P. char8
448448
@@ -471,7 +471,7 @@ charUtf8 = P.primBounded P.charUtf8
471471--
472472-- Note that 'stringUtf8' performs no codepoint validation and consequently may
473473-- emit invalid UTF-8 if asked (e.g. single surrogates).
474- {-# INLINE [1] stringUtf8 #-} -- phased to allow literal cstring rewrites
474+ {-# NOINLINE stringUtf8 #-}
475475stringUtf8 :: String -> Builder
476476stringUtf8 = P. primMapListBounded P. charUtf8
477477
Original file line number Diff line number Diff line change @@ -259,6 +259,10 @@ asclit, utflit :: Ptr Word8 -> Builder
259259asclit str@ (Ptr addr) = BI. ascLiteralCopy str (byteCountLiteral addr)
260260utflit str@ (Ptr addr) = BI. modUtf8LitCopy str (byteCountLiteral addr)
261261
262+ ascStr , utfStr :: String
263+ ascStr = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
264+ utfStr = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
265+
262266main :: IO ()
263267main = do
264268 defaultMain
@@ -273,6 +277,10 @@ main = do
273277 , benchB' " String" () $ \ () -> asclit (Ptr " hello world!" # )
274278 , benchB' " AsciiLit" () $ \ () -> asclit ascBuf
275279 , benchB' " Utf8Lit" () $ \ () -> utflit utfBuf
280+ , benchB' " strLit" () $ \ () -> string8 ascStr
281+ , benchB' " utfLit" () $ \ () -> stringUtf8 utfStr
282+ , benchB' " strLitInline" () $ \ () -> string8 " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
283+ , benchB' " utfLitInline" () $ \ () -> stringUtf8 " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
276284 ]
277285
278286 , bgroup " Encoding wrappers"
You can’t perform that action at this time.
0 commit comments