14

I'm interested in canvasing opinion about options for Scala data-structure serialization. I'd like to find something which is developed enough to allow (if possible) efficient binary serialization of the Scala collection types (i.e. not using generic Java reflection - I don't want to be serializing all parts of a collection class, including internal book-keeping data) but also allows me to extend functionality for my own purposes/classes: I am more than happy to have to write serialization code for each of our own classes, but would rather not have to do it for collections from the Scala standard libraries. In C++ I get a lot of this functionality from the Boost serialization library.

I've used SBinary in the past and it does some of what I want, but is not getting obvious active maintenance and doesn't seem (afaik) to keep track of objects already serialized (e.g. for DAGs or cyclic datastructures).

Are there other Scala-specific solutions, or if not, what are your recommendations for efficient binary serialization?

1
  • Binary serialization is, generally, a hard problem. Since the Scala community is on the smaller side, I suspect many people just live with a Java library (see stackoverflow.com/questions/239280/…) or roll their own. Commented Sep 20, 2012 at 14:25

2 Answers 2

2

Probably, if you only need to serialize data and not whole java objects, best solutions are :

I am using msgpack and bson in several projects and they work pretty well. I really recommend msgpack – has most efficient binary representation (of these three) and is fully JSON compatibile.

Sign up to request clarification or add additional context in comments.

Comments

1

A protocol buffers compiler for Scala: https://github.com/SandroGrzicic/ScalaBuff - perhaps this can help?

There's a couple of other links at the bottom of this page: http://doc.akka.io/docs/akka/snapshot/scala/serialization.html

1 Comment

Thanks for the suggestion. I'm keen to keep it all in one language if possible though. I'm currently using SBinary again, but it feels like with a bit more love it could be much more useful. I guess I should put my money where my mouth is and fork it... :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.