Rick

Rick
Rick

Friday, April 18, 2014

Boon JSON sersialization versus Kryo binary serialization versus Java Object Serialization

Benchmark                                            Mode Thr     Count  Sec         Mean   Mean error    Units
i.g.j.s.MainBoonSerializer.roundTripBig             thrpt  16         6    1      101.078       12.809    ops/s
i.g.j.s.MainJavaSerialization.roundTripBig          thrpt  16         6    1       90.572       10.920    ops/s
i.g.j.s.MainKryoJavaSerialization.roundTripBig      thrpt  16         6    1      243.711       27.724    ops/s
Boon beats regular Java serialization but gets knocked out by Kryo (expected).
i.g.j.s.MainBoonSerializer.roundTriper              thrpt  16         6    1   312757.286    75458.502    ops/s
i.g.j.s.MainJavaSerialization.roundTriper           thrpt  16         6    1    43946.267    61072.541    ops/s
i.g.j.s.MainKryoJavaSerialization.roundTriper       thrpt  16         6    1   598530.894   123891.409    ops/s
Boon beats regular Java serialization by 6x and gets to around 51% of Kryo.
i.g.j.s.MainBoonSerializer.serializeBig             thrpt  16         6    1      375.406       27.258    ops/s
i.g.j.s.MainJavaSerialization.serializeBig          thrpt  16         6    1      163.522       12.249    ops/s
i.g.j.s.MainKryoJavaSerialization.serializeBig      thrpt  16         6    1      454.381       22.956    ops/s
Boon kills built-in Java serialization and gets within 82% of Kryo. That is fast. Remember Boon is parsing JSON and producing JSON.
i.g.j.s.MainBoonSerializer.serializeSmall           thrpt  16         6    1   923105.250    51177.109    ops/s
i.g.j.s.MainJavaSerialization.serializeSmall        thrpt  16         6    1   373966.467    22819.103    ops/s
i.g.j.s.MainKryoJavaSerialization.serializeSmall    thrpt  16         6    1  1236715.808   120829.521    ops/s
Boon kills built in Java serialization and does not do too bad against Kryo about 75% or so of Kryo that is not bad for a JSON serializer.
Boon is not just one of the fastest JSON parser and serializers. Boon is one of the fastest Java serializer period. It just happens to use JSON. 


Caveat: I have no idea if I am using Kryo correctly, and I am not 100% sure if this test is even fair. But I think it is. I mean I did not deliberately cheat. I have used Kryo before on projects.


If you found this interesting you might find these related articles interesting.


Which is faster serializing to JSON with Jackson or serializing to binary with ObjectOutputStream? 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. http://www.dzone.com/links/which_is_faster_serializing_to_json_with_jackson.html

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.



Need help with gradlew for a vertx fork and PR - it works, but I want it to be better

I could use some help. I am new to Gradle. And my gradle looks a lot more like ant than gradle.
Background
Hazelcast 3.2 has critical bug fixes and performance enhancements.

Vert.x is currently 6 minor releases behind, and one major release. 

Projects that are using Hazelcast 3.x are unable to deploy on Vert.x due to classpath issues.

https://groups.google.com/forum/#!msg/vertx/3M77Zixjab8/BlDzGIMtuGIJ

So I try to be a good open source community guy. I join eclipse foundation, jump through a few hoops, and write a bug report and then submit a PR. I think this like my 3rd PR so I won't I am a newbie, but I am a newbie. (I get more PRs than I send.)
I write the list. A few people agree... and then.. I get this.
RE: I think only for Vert.x 3.x or as an extra jar maybe ? --Norman Maurer
This makes sense actually. The issue is my gradle skill are not full ninja with gradle.

They are more like half ninja or 1/4 ninja or maybe just cartoon ninja.

But lack of knowledge has never stopped me before so...
I did it.
DONE!
Cue the large aircraft carrier with the banner.

Ok, so it works, but I want it to better so I was hoping that a true gradle ninja would look at the script and help a brother out.
Now back to what I did....
I modified the build script to produce two jar files. One for vertx-hazelcast and one for vertx-hazelcast3.
In addition:
  • modified testsuite to use hazelcast2 or hazelcast3
  • created two sets of cluster xml files
  • modified the build script to create two vertx distributions (one for hazelcast2 and one for hazel cast 3)
  • modified script creates tar.gz and zip file for new distribution with the correct hazelcast jar files copied in
See:

You can see the diffs here so you can get a good idea of before and after.
Hazelcast 3.2 has some critical bug fixes in it.
To use Hazelcast 3.2 with vertx use the distribution file called:
vert.x.hazel3cluster-${version}.zip
Or
vert.x.hazel3cluster-${version}.tar.gz
The files
vert.x-${version}.zip
Or
vert.x-${version}.tar.gz
Contain Hazelcast 2.x support.
In vert.x.hazel3cluster-${version} you will find:
.

├── api-docs
├── bin
│   ├── vertx
│   └── vertx.bat
├── client
│   └── vertxbus-2.1.js
├── conf
│   ├── META-INF
│   │   └── services
│   │       └── org.vertx.java.platform.PlatformManagerFactory
│   ├── cluster.xml
│   ├── default-cluster.xml
│   ├── langs.properties
│   ├── logging.properties
│   └── repos.txt
└── lib
    ├── hazelcast-3.2.jar
    ├── jackson-annotations-2.2.2.jar
    ├── jackson-core-2.2.2.jar
    ├── jackson-databind-2.2.2.jar
    ├── netty-all-4.0.18.Final.jar
    ├── vertx-core-2.1RC4-SNAPSHOT.jar
    ├── vertx-hazelcast3-2.1RC4-SNAPSHOT.jar
    └── vertx-platform-2.1RC4-SNAPSHOT.jar
The key here is that hazelcast-3.2.jar and vertx-hazelcast3-2.1RC4-SNAPSHOT.jar are included.
In vert.x-${version} you will find:
.
├── api-docs
├── bin
│   ├── vertx
│   └── vertx.bat
├── client
│   └── vertxbus-2.1.js
├── conf
│   ├── META-INF
│   │   └── services
│   │       └── org.vertx.java.platform.PlatformManagerFactory
│   ├── cluster.xml
│   ├── default-cluster-hazelcast-3.xml
│   ├── langs.properties
│   ├── logging.properties
│   └── repos.txt
└── lib
    ├── hazelcast-2.6.7.jar
    ├── jackson-annotations-2.2.2.jar
    ├── jackson-core-2.2.2.jar
    ├── jackson-databind-2.2.2.jar
    ├── netty-all-4.0.18.Final.jar
    ├── vertx-core-2.1RC4-SNAPSHOT.jar
    ├── vertx-hazelcast-2.1RC4-SNAPSHOT.jar
    └── vertx-platform-2.1RC4-SNAPSHOT.jar
The key here is that hazelcast-3.2.jar and vertx-hazelcast3-2.1RC4-SNAPSHOT.jar are not included,
hazelcast-2.6.7.jar and vertx-hazelcast-2.1RC4-SNAPSHOT.jar are included.
What follows is some documentation of changes that were made to gradle builds files and vertx to support this effort.

new vertx subproject called vertx-hazelcast3

A new gradle jar project was created called 'vertx-hazelcast3'.
Vertx uses a service location pattern to load the in a pluggable cluster manager.
This fix employs the pluggable nature of vertx cluster manager to plugin Hazelcast 3 instead of Hazelcast 2.

testing with Hazelcast 3

The gradle build can either test hazelcast 3 or hazelcast2.
You specify testing with hazelcast3 by passing gradlew -p as follows:
./gradlew -Ph3 clean test
Or you can pass -Phazelcast3 as follows:
./gradlew -Phazelcast3 clean test
If you do not specify -Ph3 or -Phazelcast3, then hazelcast 2.x will be used for testing.

Chagnes to gradle.properties

gradle.properties has a new property called hazelcastVersion3.
gradle.properties.
...

# dependency versions
hazelcastVersion=2.6.7
hazelcastVersion3=3.2
jacksonCoreVersion=2.2.2
jacksonDatabindVersion=2.2.2

...
This determines which version of hazelcast 3 that gradle will build with.

Changes to gradle.build

In gradle.build we added two new tasks that the assemble task depends on as follows:
task assemble(type: Copy, dependsOn: ['assembleHazelcast2', 'assembleHazelcast3']) {
...
These tasks aid in building the distribution folder that gets turned into a zip file and a tar.gz file.
They ensure that only hazelcast2 or hazelcast3 jar files are included to avoid classpath dependency issues.
Similarly the dist task has been modified to depend on two additional tasks, namely distZipHazelcast3and distTarHazelcast3.
task dist(dependsOn: ['distTar', 'distZip', 'distZipHazelcast3', 'distTarHazelcast3']){
...
These task include the correct distribution folder.
Changes to testsuites
The vertx-testsuites either run hazelcast3 cluster or hazlecast2 cluster by conditionally including the correct dependency based on the h3 and hazelcast3.

Note I tired using a property like compile project(':${myprop}') but gradle gave me the one finger solute.

if (hasProperty("h3") || hasProperty("hazelcast3")) {

    println("YOU ARE TESTING WITH HAZELCAST 3!")

    dependencies {
        compile project(':vertx-core')
        compile project(':vertx-platform')
        compile project(':vertx-hazelcast3')
    }
} else {


    println("normal test")
    dependencies {
        compile project(':vertx-core')
        compile project(':vertx-platform')
        compile project(':vertx-hazelcast')
    }
}

FastJSON (Rocky), Mr T. (Boon) wants to take you on for the JSON Java Serialization championship match of the world

Ok.. So I heard a lot about FastJson.

https://github.com/alibaba/fastjson/wiki/_pages

https://github.com/RuedigerMoeller/fast-serialization/wiki/TestPage

Time to pony up to the bar and see how fast FastJSON is....

Interviewer: Do you hate Rocky?
Clubber Lang: No, I don't hate Balboa. I pity the fool, and I will destroy any man who tries to take what I got!


Mr T says I pity the fool who names his parser FastJSON.....

Round 1.
i.g.j.s.MainBoonSerializer.roundTripBig          thrpt  16         3    1      109.539      180.206    ops/s
i.g.j.s.MainFastJsonSerializer.roundTripBig      thrpt  16         3    1       77.767      442.537    ops/s
FastJSON comes out swinging. Boon lands a solid punch on the chin send FastJSON back a few steps and FastJSON wonders what just hit him.
We did not expect this. Wow!


Round 2:
i.g.j.s.MainBoonSerializer.roundTriper           thrpt  16         3    1   322589.867   263964.706    ops/s
i.g.j.s.MainFastJsonSerializer.roundTriper       thrpt  16         3    1   372651.528    60503.278    ops/s
Photo finish, but Boon comes out swinging hard, and FastJSON eeks out a small victory. Time to fire up yourKit and VisualVM.

Round 3
i.g.j.s.MainBoonSerializer.serializeBig          thrpt  16         3    1      386.978       52.936    ops/s
i.g.j.s.MainFastJsonSerializer.serializeBig      thrpt  16         3    1      143.339      130.480    ops/s
Boon body slams FastJSON. Don't call it a come back. Do you smell what the Boon has been cooking?! Boon demolishes FastJSON.


Round 4
i.g.j.s.MainBoonSerializer.serializeSmall        thrpt  16         3    1   970575.272    34411.444    ops/s
i.g.j.s.MainFastJsonSerializer.serializeSmall    thrpt  16         3    1   784787.311    85672.955    ops/s
Sonic Boon! Allyoucan! Triple twirling punch to the chin. The new world champion in Java JSON serialization. The crowd roars. Boon wins! Boon wins! What an upset victory!







What you thought Rocky was going to win? This is not some Hollywood movie fool! How many Italian guys are the world champion boxer of the world? I pity the fool!


Caveat: I have no idea if I am using FastJSON correctly, and I am not 100% sure if this test is even fair. But I think it is. I mean I did not deliberately cheat. And  please note, lack of sleep makes me silly. FASTJson looks very awesome and its ability to keep up with the fastest binary serializers is very impressive too.  This was not the world championship more like a exhibition fight.

FASTJson does all sorts of runtime code gen is my understanding. So it could be that I did not give it enough time to warm up or it could be that although the code gen bought it speed in accessing Java properties, the JSON parser is just slower. I don't really know.

If you found this interesting than a slightly more serious version of this is here:


Which is faster serializing to JSON with Jackson or serializing to binary with ObjectOutputStream? 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. http://www.dzone.com/links/which_is_faster_serializing_to_json_with_jackson.html

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.








Which is faster Java Object Serialization (ObjectOutputStream/ObjectInputStream) or Jackson JSON serialization? The answer will surprise you.

Most people assume that Java object serialization is faster than Jackson JSON serialization because Jackson is using JSON and Java object serialization is binary. But most people are wrong.
Jackson JSON serialization is much faster than built in Java object serialization.
Boon JSON serialization is much faster than Jackson JSON serialization.

There are serveral tests. There is a one that serializes the data. One test serializes and then reads. Then there are two types of Object graphs. One is small and one is quite beefy.

We run the benchmarks with JMH (info on JMH below). The full source for the benchmark code is on github.


java -jar target/microbenchmarks.jar ".*serialization.*" -wi 2 -i 3 -f 2 -t 16 



Boon 14 

Testing the Jackson and Boon JSON serializers vs. Java Object serialization.
i.g.j.s.MainBoonSerializer.roundTripBig              thrpt  16         6    1      101.708       11.041    ops/s
i.g.j.s.MainJavaSerialization.roundTripBig           thrpt  16         6    1       91.339        4.354    ops/s
i.g.j.s.MainJacksonSerializer.roundTripBig           thrpt  16         6    1       76.406        2.671    ops/s
Boon wins by 30%. Jackson comes in third. Boon beats Java binary serialization. :)
i.g.j.s.MainBoonSerializer.serializeBig              thrpt  16         6    1      377.694       20.544    ops/s
i.g.j.s.MainJavaSerialization.serializeBig           thrpt  16         6    1      174.208       23.116    ops/s
i.g.j.s.MainJacksonSerializer.serializeBig           thrpt  16         6    1      186.008       16.769    ops/s
Boon wins by 2x.
i.g.j.s.MainBoonSerializer.roundTriper               thrpt  16         6    1   312390.819    57581.454    ops/s
i.g.j.s.MainJacksonSerializer.roundTriper            thrpt  16         6    1   218978.594    44249.526    ops/s
i.g.j.s.MainJavaSerialization.roundTriper            thrpt  16         6    1    47756.764    59303.464    ops/s
Both Boon and Jackson kill Java serialization. Boon also kills Jackson serialization round trip.
i.g.j.s.MainBoonSerializer.serializeSmall            thrpt  16         6    1   936352.708   137569.222    ops/s
i.g.j.s.MainJacksonSerializer.serializeSmall         thrpt  16         6    1   636723.378    31346.173    ops/s
i.g.j.s.MainJavaSerialization.serializeSmall         thrpt  16         6    1   382283.631    25397.336    ops/s
Boon wins by a 30% margin. Jackson comes in second. Both demolish Java built-in serialization.
I recently added some optimizations to Boon JSON serialization 15 (still in snapshot). Let's see what it does to performance.
Benchmark                                        Mode Thr     Count  Sec         Mean   Mean error    Units
i.g.j.s.MainBoonSerializer.serializeSmall       thrpt  16         6    1   928002.808    60950.051    ops/s
i.g.j.s.MainJacksonSerializer.serializeSmall    thrpt  16         6    1   611743.833    79255.225    ops/s
i.g.j.s.MainJavaSerialization.serializeSmall    thrpt  16         6    1   379509.836    14233.369    ops/s
About the same.
i.g.j.s.MainBoonSerializer.roundTripBig         thrpt  16         6    1       96.589       34.860    ops/s
i.g.j.s.MainJavaSerialization.roundTripBig      thrpt  16         6    1       87.097        8.706    ops/s
i.g.j.s.MainJacksonSerializer.roundTripBig      thrpt  16         6    1       78.378        9.286    ops/s
About the same.
i.g.j.s.MainBoonSerializer.roundTriper          thrpt  16         6    1   303601.772    67861.688    ops/s
i.g.j.s.MainJacksonSerializer.roundTriper       thrpt  16         6    1   206512.825     9533.699    ops/s
i.g.j.s.MainJavaSerialization.roundTriper       thrpt  16         6    1    42197.833    60428.583    ops/s
About the same.
i.g.j.s.MainBoonSerializer.serializeBig         thrpt  16         6    1      356.867       28.637    ops/s
i.g.j.s.MainJacksonSerializer.serializeBig      thrpt  16         6    1      173.494       24.818    ops/s
i.g.j.s.MainJavaSerialization.serializeBig      thrpt  16         6    1      163.283       23.345    ops/s
About the same as before.
In short. Jackson is very fast. Boon is faster. And my latest rounds of optimizations did nothing. :(

Have you heard of Boon JSON parser? Have you heard of Boon?

Groovy and Boon provide the fastest JSON parser for the JVM | Java JSON Benchmarks for Jackson vs. Boon/Groovy

Boon Home | Boon Source | If you are new to boon, you might want to start here. Simple opinionated Java for the novice to expert level Java Programmer. Low Ceremony. High Productivity. A real boon to Java to developers!

Boon and Groovy 2.3 provide the fastest JSON parser on the JVM. 


Jackson is consistently faster than GSON and JSONSmart.
The Boon JSON parser and the new Groovy 2.3 JSON parser are faster than Jackson.



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[].

Groovy JSON support and Boon JSON support are also faster than Jackson at encoding JSON strings. Boon is faster than Jackson at serializing/de-serializing Java instances to/fro JSON. The core of the Boon JSON parser has been forked into Groovy 2.3 (now in Beta). In the process Boon JSON support was improved and further enhanced. Groovy and Boon JSON parsers speeds are equivalent. Groovy now has the fastest JSON parser on the JVM. 

The new Groovy JSON parser based on Boon JSON parser is 20x faster than the previous Groovy JSON parser circa Groovy 2.2.

If you are using Groovy, just upgrade to Groovy 2.3 and should see the speedup. If you are using Java and you can't or wont use Groovy then follow this guide 10 minutes guide to using Boon JSON support (Boon is a Java lib). You can also use Boon with Groovy or Scala or ... :)

See the full benchmarks at Boon JSON Parser versus Jackson with source code.







Java Boon/Groovy vs Jackson - JSON Benchmarks

Boon comes with a very fast JSON parser which has now been ported / forked into Groovy 2.3.

JSON Benchmarks

The benchmarks were done with OpenJDK, and we used sample JSON. 
We used JMH which is what OpenJDK uses. We used the json files from json.org for parsing.


Summary of Results

So maybe you heard the JSONSmart was faster than Jackson. Well you heard wrong. 
The JSONSmart benchmarks were seriously flawed and did not allow for any sort of warmup. 
So in effect for all practical purposes, they are useless.
When we tested Jackson against JSONSmart and GSON, for the most part (like 95% of the time) Jackson always wins. 
Jackson is consistently faster than GSON and JSONSmart. No DOUBT!

But Boon is consistently faster than Jackson and sometimes a lot faster.
Boon JSON parser is faster than Jackson with Readerreading filesbyte[], and char[] and String.
Boon is 3x to 5x faster than Jackson at parsing JSON from String and char[], and 2x to 4x faster at parsing byte[].
Boon and Jackson speeds are much closer with InputStream based parsing. Boon is usually faster at InputStream, but the margins are much smaller.
Boon and Jackson are close at handling InputStream if the JSON stream is small. Once the JSON stream gets over 1KB to 2KB, Boon wins consistently.
Boon is faster at encoding JSON strings, and serializing/de-serializing Java instances to/from JSON than Jackson.

Boon is more than a JSON parser. Learn more about the JSON Boon benchmarks here:



For the non-technical out there who might stumble on this blog post and ask a silly question like is this important.


So let's say your neighbor bought a new Corvette and he called that Corvette Jackson...

Jackson JSON Parser



Hey that is very nice, and fast!

Well you just bought a jet engine named Boon, and rocket ship named Groovy. So while he is doing 140 MPH, you are breaking the sound barrier! Of course now all of your neighbors hate you, but you own a space ship and a rocket so who cares!

Groovy JSON Parser



Boon JSON Parser




The new Groovy JSON parser 2.3 based on Boon JSON parser is 20x faster than the previous Groovy JSON parser circa Groovy 2.2. So Groovy JSON support was like riding a fast horse, but now it is a fighter jet.

Groovy JSON Parser 2.2




Groovy JSON Parser 2.3




Boon JSON and Groovy JSON Benchmarks.

(Maybe not the best choice for horse, but when I think of horse riding, I think of the toughest leader who can probably beat up Chuck Norris riding shirtless no political affiliation or social commentary implied whatsoever.)

Learn more about Boon here:

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.



Why Boon?

Easily read in files into lines or a giant string with one method call. Works with files, URLs, class-path, etc. Boon IO support will surprise you how easy it is. Boon has Slice notation for dealing with Strings, Lists, primitive arrays, Tree Maps, etc. If you are from Groovy land, Ruby land, Python land, or whatever land, and you have to use Java then Boon might give you some relief from API bloat. If you are like me, and you like to use Java, then Boon is for you too. Boon lets Java be Java, but adds the missing productive APIs from Python, Ruby, and Groovy. Boon may not be Ruby or Groovy, but its a real Boon to Java development.

Core Boon Philosophy

Core Boon will never have any dependencies. It will always be able to run as a single jar. This is not just NIH, but it is partly. My view of what Java needs is more inline with what Python, Ruby and Groovy provide. Boon is an addition on top of the JVM to make up the difference between the harder to use APIs that come with Java and the types of utilities that are built into Ruby, Python, PHP, Groovy etc. Boon is a Java centric view of those libs. The vision of Boon and the current implementation is really far apart.

JMeter vs. Gatling: Fact Checking: SHILL! ASTROTURFING SHILL!