Reputation: 1352
Use of Java's native serialization is kind of frowned upon these days, but is there a serialization library that is feature by feature equal to Java's native serialization? What I mean is that:
(Listed by priority)
I know variants of this question have been asked a few times on StackOverflow, but I couldn't find a conclusive answer, so I'm hoping to get some good conclusive answers this time.
Upvotes: 1
Views: 2334
Reputation: 3446
https://github.com/RuedigerMoeller/fast-serialization
is pretty close to what you are looking for. It supports all JDK-Serialization special methods, so you can try without lots of code change.
Upvotes: 2
Reputation: 533462
This project compares performance of a range of serialization techniques. Note: It lists Externalizable (which uses Java Serialization) as the fastest,
http://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking
I did a performance comparison with a faster technique, but it is harder to get right than Externalizable and I wouldn't recommends it unless you need ultra-low latency.
http://vanillajava.blogspot.com/2011/10/serialization-using-bytebuffer-and.html
The real questions is; How much effort is it worth to make it faster? If you are looking for a quick win, I suspect you will be disappointed. If you are willing to put in some effort, you can make significant improvements.
I would like at using Externalizable first because you can convert a few key classes (the ones which take most of the time now) and leave most of the classes unchanged. i.e. It may allow you to get the best of both worlds.
Upvotes: 0
Reputation: 3508
If you are concerned about performance as well as productivity, you can consider Babel. Using Babel and an additional sidl file (which looks like a Java interface) you can transparently invoke functions defined in C, C++, Fortran, Python, etc. from Java and vice versa. Babel will handle serialization behind the scenes.
Upvotes: 0
Reputation: 8107
You could have a look at Google Proto Buffer or Kryo. GPB is stable and very fast, it also available in C++. I did not use Kryo before but there's some benchmark look good.
Upvotes: 5