Commits

Bryan O'Sullivan committed 9d64e67

Rework objectValues to use commaSeparated

This gives us a further 10% performance improvement when parsing
object-heavy inputs, e.g. json-data/twitter100.json (gh-134).

  • Participants
  • Parent commits d6f063e

Comments (0)

Files changed (1)

File Data/Aeson/Parser/Internal.hs

         a <- str <* skipSpace
         b <- char ':' *> skipSpace *> val
         return (a,b)
-  vals <- ((pair <* skipSpace) `sepBy` (char ',' *> skipSpace)) <* char '}'
-  return (H.fromList vals)
+  H.fromList <$> commaSeparated pair closeCurly
 {-# INLINE objectValues #-}
 
 array_ :: Parser Value
     !n <- rational
     return (Number n)
 
-backslash, closeSquare, comma, doubleQuote :: Word8
+backslash, closeCurly, closeSquare, comma, doubleQuote :: Word8
 backslash = 92
+closeCurly = 125
 closeSquare = 93
 comma = 44
 doubleQuote = 34
 {-# INLINE backslash #-}
+{-# INLINE closeCurly #-}
 {-# INLINE closeSquare #-}
 {-# INLINE comma #-}
 {-# INLINE doubleQuote #-}