BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Groovy 2.3 gets a much faster JSON Parser

Groovy 2.3 gets a much faster JSON Parser

Lire ce contenu en français

Bookmarks

Groovy 2.3 will ship with one of the fastest JSON parsers on the JVM, according to Rick Hightower, the ubiquitous consultant and author. In his article on JSON serialization benchmarks, Hightower claims that Groovy's JSON support and the Boon JSON parser are up to 3 to 5 times faster than the current Jackson parser at parsing JSON from String and char arrays, and 2 to 4 times faster at parsing byte arrays.

Russian developer Andrey Bloschetsov created a json-benchmarks GitHub project with the aim of benchmarking each of the popular JVM parsers against each other. The project compares performance between Jackson, Gson, Boon, and Groovy 2.3.

To test each parser, data was selected that has many different variations in structure:

  • citys - A large array (29470 items) of simple objects. The compact json representation takes about 2.5 MB.
  • repos.json - An array of four objects with complex structure. The compact json representation takes about 342.8 kB.
  • user.json - one object with a complex structure. The compact json representation takes about 4.2 kB.
  • response.json - one object with a simple structure. The compact json representation takes about 425 B.

Serialization was tested with two variants:

  • pojo - Objects were presented as POJO objects.
  • maplist - Objects were presented as Maps.

Deserialization was tested only with a single transformation use-case: from Strings to Maps.

The race concluded with Boon in first place, Groovy 2.3 placing a strong second, Jackson finishing third, and Gson following in last place.

To learn more about what this means for Groovy, InfoQ talked with Guillaume Laforge, Groovy Project Manager at Pivotal.

InfoQ: What made you decide to fork Boon and use it in Groovy 2.3?

I've been following Rick Hightower's work on his Boon framework, and was impressed by the speed he was getting out of his JSON parsing technique. So I contacted him to ask him if it was possible to retrofit this parsing technique to our existing JSON support that I had developed years ago for Groovy. Rick kindly offered to help, forking Boon to make it the underlying parsing technology of our JSON parsers. And the results published in his benchmarks are pretty impressive, to say the least.

InfoQ: How much faster is JSON parsing in Groovy 2.3 than in prior versions?

Obviously, it highly depends on the kind of JSON payload you're working with, how you measure, etc, but from what I gather from the benchmarks, you can assume that Groovy's JSON parsing (and hence Rick's Boon parsers) is at least 3 to 4 times faster than other JSON libraries available today.

When will Grails users be able to take advantage of Groovy 2.3?

Our plan is to release Groovy 2.3 within a week or so, so that Grails 2.4 can integrate Groovy 2.3 for its release targeted for mid-May. The second milestone of Grails 2.4 released this week actually already bundles Groovy 2.3-beta-2. So it's just a matter of weeks before Grails users can take advantage of Groovy 2.3.

Rate this Article

Adoption
Style

BT