in reply to Serialise to binary?

Depending on your data structure, you might have more luck with Sereal.