on master help sign in
Improve parser performance almost 2x for unescaped text.
commitc5e10a23cb435650727a3cabc5d43cb29bf14d91 authorBryan O'Sullivan <bos@mailrank.com> dateThu 27 Jan 2011, 12:20 (16 years ago) parent7a01158
1 file changed+3−1
Data/Aeson/Parser.hs+3−1
Data/Aeson/Parser.hs+3−1
@@ -80,7 +80,9 @@ jstring_ = do
8080 then Nothing
8181 else Just (c == backslash)
8282 _ <- A.word8 doubleQuote
83− (decodeUtf8 . B.concat) <$> reparse unescape s
83+ if backslash `B.elem` s
84+ then (decodeUtf8 . B.concat) <$> reparse unescape s
85+ else return (decodeUtf8 s)
8486
8587reparse :: Parser a -> ByteString -> Parser a
8688reparse p s = case (case parse p s of {Partial k -> k ""; r -> r}) of