Hey everyone! First of two library releases today...
Github: https://github.com/ptaoussanis/nippy
Clojars: https://clojars.org/com.taoensso/nippy
Features (taken from readme):
* Simple, high-performance all-Clojure de/serializer.
* Comprehensive, extensible support for all major data types.
* Reader-fallback for difficult/future types.
* Full test coverage for every supported type.
* Snappy integrated de/compression for efficient storage and network transfer.
Cheers!
- Peter Taoussanis (@ptaoussanis)
Can't wait to test it out.
By the way, do you have a performance comparison between Nippy and
carbonite(the one wraps kryo) ?
With the tag literal support of 1.4+, is that kind of the idiomatic way of the future to structure protocols for serialized clojure data/code?
When you say that Nippy is much faster than the reader, are there ways to improve on or optimize the reader?
(guess the speed improvement is only achieved for true data (?))
1) buffer reuse - reusing cached ThreadLocal byte[] for converting from data to bytes is a nice trick and made possible in most serialization libs but I don't that's possible in the current code.
2) transients while deserializing collections (in coll-thaw!) - I found this to be the only way to get anywhere close to Java serialization while benchmarking.
3) more efficient primitive writing - this is the main reason I wrapped Kryo - there are lots of well-known tricks for writing chars, ints, etc. Thrift, Protobuff, Kryo, and others have made these pretty standard and they make a huge difference vs the basic DataInputStream serialization.
I found the use of transients in deserializing collections to be the only way I could get anywhere close to Java serialization performance - they are critical.