Skip to content

Presentation: Jackson Performance

cowtowncoder edited this page Aug 8, 2012 · 24 revisions

Turbo-charging Jackson

Although Jackson JSON Processor is fast right out-of-the-box, with default settings and common usage patterns, there are ways to make it process things even faster. This presentation looks at couple of things you can use that can make a big difference in performance, for cases where every last drop of CPU power is needed.

Basics: Things You Should Do Anyway

(note: this section is inspired by Jackson Performance: best practices Wiki page at FasterXML Jackson Wiki

There is a small number of basic ground rules to follow, to ensure that Jackson processes things at optimal level. These are things that you should "do anyway", even if you do not have actual performance problems: think of them as an interpretation of the "Boy Scout Rule" ("Always leave the campground cleaner than you found it").

  1. Reuse heavy-weight objects: ObjectMapper (data-binding) and `JsonFactory (streaming API)
  • To a lesser degree, you may also want to reuse ObjectReader and ObjectWriter instances -- this is just some icing on the cake, but they are fully thread-safe and reusable
Clone this wiki locally