Table 10-6. Performance of alternate JSON parsers
Items processed Java EE JSON parser Jackson JSON parser
This is a usual situation for new JSR reference implementations; just as the JDK 7 XML
parser is much faster than previous versions, new JSON-P parsers can be expected to show
large performance gains as well. (In fact, the numbers in this section are using the 1.0.2 ver-
sion of the reference JSON parser, which is about 65% faster on this test than the initial 1.0
1. Choosing the right parser can have a big impact on the performance of an applica-
2. Push parsers tend to be faster than pull parsers.
3. The algorithm used to find the factory for a parser can be quite time-consuming; if
possible, bypass the services implementation and specify a factory directly via a
4. At any point in time, the winner of the fastest parser implementation race may be
different. Seek out alternate parsers when appropriate.
XML data can optionally be validated against a schema. This allows the parser to reject a
document that isn't well formed—meaning one that is missing some required information, or
one that contains some unexpected information. “Well formed” is used here in terms of the
content of the document; if the document has a syntax error (e.g., content not within an XML
tag, or a missing XML closing tag, etc.), then all parsers will reject the document.