Skip to content

Commit

Permalink
Improve parser performance almost 2x for unescaped text.
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Jan 27, 2011
1 parent 3568e5e commit 79f192c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Data/Aeson/Parser.hs
Expand Up @@ -80,7 +80,9 @@ jstring_ = do
then Nothing
else Just (c == backslash)
_ <- A.word8 doubleQuote
(decodeUtf8 . B.concat) <$> reparse unescape s
if backslash `B.elem` s
then (decodeUtf8 . B.concat) <$> reparse unescape s
else return (decodeUtf8 s)

reparse :: Parser a -> ByteString -> Parser a
reparse p s = case (case parse p s of {Partial k -> k ""; r -> r}) of
Expand Down

0 comments on commit 79f192c

Please sign in to comment.