Winery: fast, compact and sustainable serialisation library


(crossposting r/haskell)

I’m happy to announce a new serialisation library, winery. It features high performance, low space usage and extensibility.

The major difference from other approaches is the presence of schemata.

A schema is derived from a datatype and it conveys various information such as field or constructor names, types etc. This grants high availability of data unlike binary or cereal, where you can no longer read data if the datatype changes. Also, it’s much more compact than CBOR or JSON because all the metadata are factored out to a schema.

Here’s a benchmark result comparing the performance and space usage of commonly used libraries (processing 1000 of 8-fields records):

encode 1 encode 1000 decode length
winery 0.28 μs 0.26 ms 0.81 ms 58662
cereal 0.82 μs 0.78 ms 0.90 ms 91709
binary 1.7 μs 1.7 ms 2.0 ms 125709
serialise 0.61 μs 0.50 ms 1.4 ms 65437
aeson 9.9 μs 9.7 ms 17 ms 160558