Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Thrift

Protocol Buffers

Backers

Facebook, Apache (accepted for incubation)

Google

Bindings

C++, Java, Python, PHP, XSD, Ruby, C#, Perl, Objective C, Erlang, Smalltalk, OCaml, and Haskell

C++, Java, Python(Perl, Ruby, and C# under discussion)

Output Formats

Binary, JSON

Binary

Primitive Types

bool
byte
16/32/64-bit integers
double
string
byte sequence
map<t1,t2>
list<t>
set<t>

bool
32/64-bit integers
float
double
string
byte sequence
"repeated" properties act like lists

Enumerations

Yes

Yes

Constants

Yes

No

Composite Type

Struct

Message

Exception Type

Yes

No

Documentation

Bad

Good

License

Apache

BSD

Compiler Language

C++

C++

RPC Interfaces

Yes

Yes

RCP Implementation

Yes

No

Composite Type Extensions

No

Yes

...

  • Works with Java NIO
  • Provides automatic serialization (no description files, no generated classes, etc)
    • But classes have to be registered before the synchronization, or leave open registration option that influences the performance and size of the serialized bytes
    • Registration of the classes have to be done in same order always (quite non-flexible constraint)
  • Serialization
    • Provides set of already existing serialization classes for Java primitive types, Maps, Collections, etc
    • Provides FieldSerializer class that can serialize arbitrary classes. But, this class uses ReflectASM to do the serialization. Fastest serialization is possible only if the class fields are public, or protected/default and setAccessable(true) on the class loader is permitted by Security manager. Otherwise when they are private it uses "fast" reflection (and it is faster, even faster then these libraries above)
    • Provides CompatibleFieldSerializer that has the backwards and forwards compatibility, with some overhead compared to one above
    • And enables for a user to develop a custom serializers for every class. This should be the fastest solution, but a compatibility control has to also be done manually.
  • Provides support for circular references in object graph (especially important for the Invocation sequence data)
  • Multi thread support is available
  • Provides several data compressing options
    • Deflate algorithm - This somehow was not working in my tests, first I did not see any difference in size, and secondly the time needed for serialization was 15 times slower than without
    • Delta mechanism - Where only the difference from the last object is serialized, but this to work, objects have to be mainly same class and having similar fields values

...

Discover the secrets of the Java Serialization API - Basic introduction
Comparison of data serialization formats - Wikipedia
Protocol Buffers - Official page
Getting started with Apache Thrift
Thrift vs ProtocolBuffers
Kryo Project - Official page
Java serialization benchmarking
Java NIO