Here is a brief summary of the benchmark that I created**.
(** Actually no... it was forked from Stephane Landelle benchmark, and I kept adding to it. Stephane Landelle is a performance testing guru of Gatling fame, which is similar to JMeter or Grinder. Stephane Landelle was the first user of Boon JSON outside of me. I wrote Boon JSON support but it would not exist as it is today without Stephane writing the benchmarks and taunting me. Also the Boon parser got a LOT better after merge forking it into Groovy. The key is to get a lot of help from smart people. :)
"Jackson is consistently faster than GSON and JSONSmart. Boon JSON parser and the new Groovy 2.3 JSON parser are faster than Jackson. They are faster with InputStream, Reader, reading files, byte[], and char[] and String."
Again.. my benchmark is here. This blog post was all about Andrey's benchmark, which I did not write.
Now... Your regularly scheduled blog post....
Boon comes in 1st place. Groovy comes in a strong second place. Jackson comes in third. GSON comes in last.
See code and full benchmark here:
https://github.com/bura/json-benchmarks
The benchmark was created by Andrey Bloschetsov from Moscow.
JSON serialization benchmarks
Methodology
Participants:
For testing were selected data with different 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 in two versions:
Build and Run
./gradlew clean && ./gradlew shadow -DgroovyVersion="2.2.2" && java -Xmx2048m -jar target/benchmarks.jar ".*Benchmarks.*" -f 1
Summary
- Boon is in 1st place with 28 points
- Groovy 2.3 is in 2nd place with 22 points
- Jackson is in 3rd with 18 points
Boon, Groovy 2.3 and Jackson were usually in the top three.
Points
Tool | points |
---|---|
Boon | 28 |
Groovy 2.3 | 22 |
Jackson | 18 |
GSON | 3 |
1st place
Tool | Count | points |
---|---|---|
Boon | 7 | 21 points |
Jackson | 3 | 9 points |
Groovy 2.3 | 2 | 6 points |
2nd place wins
Tool | Count | points |
---|---|---|
Groovy 2.3 | 6 | 12 points |
Boon | 3 | 6 points |
Jackson | 3 | 6 points |
3rd
Tool | Count | points |
---|---|---|
Jackson | 3 | 3 points |
Boon | 2 | 2 points |
Groovy 2.3 | 4 | 4 points |
GSON | 3 | 3 points |
Results
Serialization
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | pojo | citys | thrpt | 20 | 27.412 | 0.703 | ops/s |
gson | pojo | citys | thrpt | 20 | 15.602 | 0.280 | ops/s |
boon | pojo | citys | thrpt | 20 | 25.119 | 0.519 | ops/s |
groovy | pojo | citys | thrpt | 20 | 1.684 | 0.082 | ops/s |
groovy-2.3 | pojo | citys | thrpt | 20 | 19.513 | 1.120 | ops/s |
Jackson wins but it is almost a tie between Jackson and Boon. Groovy 2.3 close on the heels of Boon and Jackson.
- Jackson 1st
- Boon 2nd
- Groovy 2.3 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | pojo | repos | thrpt | 20 | 641.999 | 14.161 | ops/s |
gson | pojo | repos | thrpt | 20 | 407.093 | 5.950 | ops/s |
boon | pojo | repos | thrpt | 20 | 24173.808 | 223.995 | ops/s |
groovy | pojo | repos | thrpt | 20 | 45.302 | 0.301 | ops/s |
groovy-2.3 | pojo | repos | thrpt | 20 | 643.902 | 10.174 | ops/s |
Boon wins by a wide margin. Groovy 2.3 beats Jackson.
- Boon 1st
- Groovy 2.3 2nd
- Jackson 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | pojo | user | thrpt | 20 | 52324.635 | 359.331 | ops/s |
gson | pojo | user | thrpt | 20 | 22010.943 | 208.352 | ops/s |
boon | pojo | user | thrpt | 20 | 241065.787 | 1764.331 | ops/s |
groovy | pojo | user | thrpt | 20 | 1751.394 | 14.458 | ops/s |
groovy-2.3 | pojo | user | thrpt | 20 | 47781.079 | 370.971 | ops/s |
Boon wins by a wide margin. Groovy 2.3 very close to Jackson, but Jackson wins.
- Boon 1st
- Jackson 2nd
- Groovy 2.3 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | pojo | request | thrpt | 20 | 629985.135 | 8049.270 | ops/s |
gson | pojo | request | thrpt | 20 | 267811.451 | 4064.942 | ops/s |
boon | pojo | request | thrpt | 20 | 344047.795 | 3447.635 | ops/s |
groovy | pojo | request | thrpt | 20 | 28826.587 | 302.826 | ops/s |
groovy-2.3 | pojo | request | thrpt | 20 | 649596.700 | 6931.673 | ops/s |
Both Jackson and Groovy 2.3 beat Boon by 2x! Groovy 2.3 beats Jackson but almost a tie.
- Jackson 1st
- Groovy 2.3 2nd
- Boon 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | maplist | citys | thrpt | 20 | 27.027 | 0.686 | ops/s |
gson | maplist | citys | thrpt | 20 | 15.997 | 0.196 | ops/s |
boon | maplist | citys | thrpt | 20 | 25.057 | 0.371 | ops/s |
groovy | maplist | citys | thrpt | 20 | 1.635 | 0.073 | ops/s |
groovy-2.3 | maplist | citys | thrpt | 20 | 19.682 | 0.435 | ops/s |
Jackson and Boon are neck and neck, but Jackson wins. Groovy 2.3 tight on the heels of Jackson and Boon.
- Jackson 1st
- Boon 2nd
- Groovy 2.3 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | maplist | repos | thrpt | 20 | 644.717 | 9.192 | ops/s |
gson | maplist | repos | thrpt | 20 | 403.760 | 4.575 | ops/s |
boon | maplist | repos | thrpt | 20 | 24173.738 | 216.084 | ops/s |
groovy | maplist | repos | thrpt | 20 | 44.343 | 0.253 | ops/s |
groovy-2.3 | maplist | repos | thrpt | 20 | 653.402 | 9.880 | ops/s |
Boon wins by a wide margin. Groovy 2.3 beats Jackson but it is a close race.
- Boon 1st
- Groovy 2.3 2nd
- Jackson 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | maplist | user | thrpt | 20 | 51317.860 | 590.524 | ops/s |
gson | maplist | user | thrpt | 20 | 21844.772 | 246.724 | ops/s |
boon | maplist | user | thrpt | 20 | 235728.318 | 2876.144 | ops/s |
groovy | maplist | user | thrpt | 20 | 1802.383 | 15.716 | ops/s |
groovy-2.3 | maplist | user | thrpt | 20 | 47497.203 | 526.286 | ops/s |
Boon wins by a wide margin. Groovy 2.3 and Jackson are really close, but Jackson wins.
- Boon 1st
- Jackson 2nd
- Groovy 2.3 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | maplist | request | thrpt | 20 | 616497.013 | 8990.165 | ops/s |
gson | maplist | request | thrpt | 20 | 268005.642 | 2219.178 | ops/s |
boon | maplist | request | thrpt | 20 | 353171.065 | 2502.621 | ops/s |
groovy | maplist | request | thrpt | 20 | 28985.824 | 459.033 | ops/s |
groovy-2.3 | maplist | request | thrpt | 20 | 630975.802 | 4892.114 | ops/s |
Jackson and Groovy 2.3 beat Boon by 2x.
- Groovy 2.3 1st
- Jackson 2nd
- Boon 3rd
Deserialization
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | N/A | citys | thrpt | 20 | 21.906 | 0.162 | ops/s |
gson | N/A | citys | thrpt | 20 | 23.377 | 0.501 | ops/s |
boon | N/A | citys | thrpt | 20 | 72.543 | 1.054 | ops/s |
groovy | N/A | citys | thrpt | 20 | 3.182 | 0.034 | ops/s |
groovy-2.3 | N/A | citys | thrpt | 20 | 52.806 | 0.329 | ops/s |
Boon wins. Groovy 2.3 comes in second.
- Boon 1st
- Groovy 2nd
- GSON 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | N/A | repos | thrpt | 20 | 484.377 | 3.571 | ops/s |
gson | N/A | repos | thrpt | 20 | 412.508 | 6.415 | ops/s |
boon | N/A | repos | thrpt | 20 | 1647.070 | 15.817 | ops/s |
groovy | N/A | repos | thrpt | 20 | 31.554 | 0.252 | ops/s |
groovy-2.3 | N/A | repos | thrpt | 20 | 1305.876 | 11.445 | ops/s |
Boon beats Jacskon by over 3x, Groovy 2.3 almost ties Boon.
- Boon 1st
- Groovy 2.3 2nd
- Jackson 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | N/A | user | thrpt | 20 | 25109.072 | 225.116 | ops/s |
gson | N/A | user | thrpt | 20 | 26982.245 | 282.070 | ops/s |
boon | N/A | user | thrpt | 20 | 72529.259 | 687.818 | ops/s |
groovy | N/A | user | thrpt | 20 | 2338.934 | 19.511 | ops/s |
groovy-2.3 | N/A | user | thrpt | 20 | 64431.577 | 1037.016 | ops/s |
Boon beats Jackson by 3x. Groovy 2.3 beats Jackson by 2x.
- Boon 1st
- Groovy 2.3 2nd
- GSON 3rd
Benchmark | (dataStyle) | (resourceName) | Mode | Samples | Mean | Mean error | Units |
---|---|---|---|---|---|---|---|
jackson | N/A | request | thrpt | 20 | 90,009.471 | 941.871 | ops/s |
gson | N/A | request | thrpt | 20 | 268,988.905 | 2165.099 | ops/s |
boon | N/A | request | thrpt | 20 | 672,907.357 | 8514.806 | ops/s |
groovy | N/A | request | thrpt | 20 | 26497.332 | 196.347 | ops/s |
groovy-2.3 | N/A | request | thrpt | 20 | 762,926.213 | 5930.640 | ops/s |
Jackson comes in fourth. Groovy 2.3 comes in 1st. Boon comes in second.
- Groovy 2.3 1st
- Boon 2nd
- GSON 3rd
Testing environment
Intel® Core™ i5-2410M CPU @ 2.30GHz × 4, Ubuntu 14.04 (64-Bit), Oracle Java HotSpot 64-bit 1.7.0_55
If you found this interesting you might find these related articles interesting.
Boon is not just a fast JSON parser, it happens to be one of the fastest ways to do Java Object Serialization period. Boon Java JSON serialization is faster than Java Object Serialization (ObjectOutputStream/ObjectInputStream). It just happens to work with JSON. Kryo, a binary serializer which is the fastest way to serialize Java objects, wins by the way, but for large streams, Boon gets within 85% of Kryo. To get Java JSON serialization within 15% of the fastest Java Binary serializer took quite some effort. Boon JSON serialization is probably in the top five Java serializers for speed, and it is the fastest way to do JSON.
Most people assume that Java object serialization is faster than Jackson JSON serialization because Jackson is using JSON and Java object serialization is binary. Is this true? Find out.
Then a even more serious with many pretty graphs article is here:
Jackson is consistently faster than GSON and JSONSmart. Boon JSON parser and the new Groovy 2.3 JSON parser are faster than Jackson. They are faster than Jackson with InputStream, Reader, reading files, byte[], and char[] and String. Groovy JSON support and the Boon JSON parser are up to 3x to 5x faster than Jackson at parsing JSON from String and char[], and 2x to 4x faster at parsing byte[].
Looking for a tutorial to get started with Boon?
This five minute guide will get you up to speed using Boon in no time. Parse and serialize Java objects to/fro JSON up to 5x faster! Boon is not a JSON parsing project. It is more than that, but JSON parsing is intrinsic to what Boon is all about. Boon is the fastest way to serialize and parse JSON in Java so far. It is faster at object serialization, enabling JSON expressions, JSON parsing and much more. Boon JSON is FAST! In addition it has a very easy to use, convention-based API. This getting started guide covers making JSON REST calls, JSON object serialization, using annotations, and more.
Need to do ETL with JSON, and/or want to search sort JSON or Java graphs quickly.
Java Boon - Boon Data Repo using Indexed Collections for Java Beans, JSON and Maps like JDK 8 streams but faster. Many languages have sorting, slicing, dicing capabilities for Lists and Maps, and JSON. Boon adds this to Java. Boon Data Repo is an in-memory query engine that can use high speed indexed collections for very fast in-memory queries. This brief tutorial will show you how to use Boon to query JSON, Java objects and Java maps. And also how to do ELT transforms with JSON, Java objects and Java Maps.
Java Boon filtering for Java Beans, JSON and Java Maps like JDK 8 streams but much faster. Many languages have support for querying objects and filtering objects easily. Java does in JDK 8, but Boon adds it as well, and it can compliment features of JDK 8 as well as work in Java 7 land. Boon adds filtering to to Java. You can filter JSON, Java, and Maps. You can also use indexed queries which are a lot faster than linear search queries that come with JDK 8.
Many languages have path expressions. Boon adds this to Java. Boon has powerful path expressions that work with objects, lists and maps. It also works with JSON. Full examples of Java, Maps/Lists and JSON are included in this tutorial.
Just curious about what Boon is...
Boon comes with helper methods that allow you to easily read files, create lists, sets, maps, concurrent maps, sorted maps, sorted sets, etc. It provides slice notation, searching, easy IO (files, http, etc.). The helper methods are safeList, list, set, sortedSet, safeSet,safeSortedSet, etc. The idea is to make Java feel more like list and maps are built-in types.
What if Java collections and Java hierarchies were easily searchable? They are with Boon! What if it were easy to query a complex set of Java objects at runtime? What if there were an API that kept your object indexes (really just TreeMaps, and HashMaps) in sync.? Well then you would have Boon's data repo. This article shows how to use Boon's data repo utilities to query Java objects. Boon comes with a simple criteria API that makes working with Java collections a snap.
Boon has many utility methods to convert objects into maps, lists, JSON, etc. It also has many collection utility methods. One such utility method is deepCopy, which will deep copy a list or set. Programmer as a way to clone Collection e.g. List, Set, ArrayList, HashSet or any other implementation. Or they write a lot of boiler plate code and spend a lot of time doing things to copy lists and sets. With Boon you can do deep copies without messing around with clone.
Boon gets some inspiration from Groovy and Python when dealing with maps, lists and JSON. It addition to adding slice notation and such, which I covered before. Boon has first class support for converting between Maps, List, JSON and Java objects. Boon gets some inspiration from Ruby, Groovy, Python and Perl and aims to make Java programming just a bit more fun.
I am still here. I wrote a microservice framework that uses Boon. It is wicked fast. It is all about JSON, Java idioms, HTTP, and WebSocket to write small, tight, fast, microservices.
Check out QBit.
[Detailed Tutorial] QBit microservice example
[Doc] Queue Callbacks for QBit queue based services
[Quick Start] Building a simple Rest web microservice server with QBit
[Quick Start] Building a TODO web microservice client with QBit
[Quick Start] Building a TODO web microservice server with QBit
[Quick Start] Building boon for the QBit microservice engine
[Quick Start] Building QBit the microservice lib for Java
[Rough Cut] Delivering up Single Page Applications from QBit Java JSON Microservice lib
[Rough Cut] Working with event bus for QBit the microservice engine
[Rough Cut] Working with inproc MicroServices
[Rough Cut] Working with private event bus for inproc microservices
[Rough Cut] Working with strongly typed event bus proxies for QBit Java Microservice lib
[Rough Cut] Working with System Manager for QBit Mircoservice lib
[Z Notebook] More benchmarking internal
[Z Notebook] Performance testing for REST
[Z Notebook] Roadmap
Home
Introduction to QBit
Local Service Proxies
QBit Boon New Wave of JSON HTTP and Websocket
QBit Docs
I am still here. I wrote a microservice framework that uses Boon. It is wicked fast. It is all about JSON, Java idioms, HTTP, and WebSocket to write small, tight, fast, microservices.
Check out QBit.
[Detailed Tutorial] QBit microservice example
No comments:
Post a Comment