Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actual JSON serialization benchmark for Java-APIs

I'm looking for an benchmark for different serialization APIs. All I found are outdated Posts and Articles from a year and more before. So I'm hoping that anyone could share a link to an up to date benchmark?

PLEASE: I'm aware of the implementations you can find in the web. I don't want a recommendation for your preferred API. And I don't need a "I think it's fast". What I'm searching for is just an actual comparison of the performance in measured values.

like image 573
Marvin Emil Brach Avatar asked Sep 05 '12 07:09

Marvin Emil Brach


People also ask

What is the difference between JSON and binary serialization?

While JSON is a common modus operandi (especially in JavaScript), using a binary serialization format typically provides an advantage in compression size and performance at the cost of losing human readability of the encoded data. Two common binary serialization formats across many programming languages are Protocol Buffers and Apache Avro.

What is the best way to serialize data in Java?

Java supports built-in serialization that is easy to use. JSON is preferable due to readability and being schema-less. Hence, both Gson and Jackson are good options for serializing JSON data. They are simple to use and well documented. For editing data, YAML is a good fit. On the other hand, binary formats are faster than textual formats.

What is the difference between JSON and BSON?

This seems to indicate that datatype json simply consists of using native JSON to create a string that is then stored as datatype string in js-binary. Performance graph of bson with different settings. Unmapped BSON is still slower than JSON in most cases, but it did receive a performance improvement, especially during decoding.

What are the limitations of serialization in Java?

There are some caveats that concern native serialization in Java: Only objects marked Serializable can be persisted. The Object class does not implement Serializable, and hence, not all the objects in Java can be persisted automatically When a class implements the Serializable interface, all its sub-classes are serializable as well.


1 Answers

Here is a one benchmark.

http://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking

In this article I discuss the importance of re-cycling objects to improve serialisation times.

http://vanillajava.blogspot.co.uk/2011/10/serialization-using-bytebuffer-and.html

IMHO: JSon is one of the most difficult formats to deserialise efficiently, even harder than XML.

like image 179
Peter Lawrey Avatar answered Sep 23 '22 08:09

Peter Lawrey