Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple, hassle-free, zero-boilerplate serialization in Scala/Java similar to Python's Pickle?
    text
    copied!<p>Is there a simple, hassle-free approach to serialization in Scala/Java that's similar to Python's pickle? Pickle is a dead-simple solution that's reasonably efficient in space and time (i.e. not abysmal) but doesn't care about cross-language accessibility, versioning, etc. and allows for optional customization.</p> <p>What I'm aware of:</p> <ul> <li>Java's built-in serialization is infamously slow (<a href="http://code.google.com/p/kryo/wiki/BenchmarksAndComparisons" rel="nofollow noreferrer">[1]</a>, <a href="https://github.com/eishay/jvm-serializers/wiki/" rel="nofollow noreferrer">[2]</a>), bloated, and fragile. Also have to mark classes as Serializable---annoying when there are things that are clearly serializable but which don't have that annotation (e.g. not many Point2D authors mark these Serializable).</li> <li>Scala's <a href="http://www.scala-lang.org/api/current/scala/io/BytePickle$.html" rel="nofollow noreferrer">BytePickle</a> requires a bunch of boilerplate for every type you want to pickle, and even then it <a href="http://scala-programming-language.1934581.n4.nabble.com/Pickling-cyclic-structures-td1989885.html" rel="nofollow noreferrer">doesn't work with (cyclic) object graphs</a>.</li> <li><a href="http://jserial.sf.net/" rel="nofollow noreferrer">jserial</a>: Unmaintained and <a href="http://jserial.sourceforge.net/faq.html#benchmarks" rel="nofollow noreferrer">doesn't seem to be that much faster/smaller</a> than the default Java serialization.</li> <li><a href="http://kryo.googlecode.com/" rel="nofollow noreferrer">kryo</a>: <a href="http://code.google.com/p/kryo/issues/detail?id=5" rel="nofollow noreferrer">Cannot (de-)serialize objects with no 0-arg ctors</a>, which is a severe limitation. (Also you have to register every class you plan to serialize, or else you get <a href="https://stackoverflow.com/questions/2725233/kryo-serialization-library-is-it-used-in-production">significant slowdowns/bloat</a>, but even so it's still faster than pickle.)</li> <li><a href="http://protostuff.googlecode.com/" rel="nofollow noreferrer">protostuff</a>: AFAICT, you have to register every class you intend to serialize in advance in a "schema."</li> </ul> <p>Kryo and protostuff are the closest solutions I've found, but I'm wondering if there's anything else out there (or if there's some way to use these that I should be aware of). Please include usage examples! Ideally also include benchmarks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload