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.



No comments:

Post a Comment

Kafka and Cassandra support, training for AWS EC2 Cassandra 3.0 Training