Fast, compact, schema-less, binary serialization and deserialization oriented towards dynamic languages
Switch branches/tags
Sereal-Path-4.004 Sereal-Path-4.003 Sereal-Path-4.002 Sereal-Path-4.001_004 Sereal-Path-4.001_003 Sereal-Path-4.001_002 Sereal-Path-4.001_001 Sereal-Path-0.014 Sereal-Path-0.013 Sereal-Path-0.011 Sereal-Path-0.010 Sereal-Path-0.009 Sereal-Path-0.008 Sereal-Path-0.007 Sereal-Path-0.004 Sereal-Path-0.003 Sereal-Path-0.002 Sereal-Path-0.001 Sereal-Merger-0.001 Sereal-Encoder-4.005 Sereal-Encoder-4.004 Sereal-Encoder-4.003 Sereal-Encoder-4.002 Sereal-Encoder-4.001_003 Sereal-Encoder-4.001_002 Sereal-Encoder-4.001_001 Sereal-Encoder-3.015 Sereal-Encoder-3.014_002 Sereal-Encoder-3.014_001 Sereal-Encoder-3.014 Sereal-Encoder-3.012 Sereal-Encoder-3.011 Sereal-Encoder-3.010 Sereal-Encoder-3.009 Sereal-Encoder-3.008 Sereal-Encoder-3.007 Sereal-Encoder-3.006_007 Sereal-Encoder-3.006_006 Sereal-Encoder-3.006_005 Sereal-Encoder-3.006_004 Sereal-Encoder-3.006_003 Sereal-Encoder-3.006_002 Sereal-Encoder-3.006_001 Sereal-Encoder-3.006 Sereal-Encoder-3.005_005 Sereal-Encoder-3.005_004 Sereal-Encoder-3.005_003 Sereal-Encoder-3.005_002 Sereal-Encoder-3.005_001 Sereal-Encoder-3.005 Sereal-Encoder-3.004 Sereal-Encoder-3.003_004 Sereal-Encoder-3.003_003 Sereal-Encoder-3.003_002 Sereal-Encoder-3.003_001 Sereal-Encoder-3.003 Sereal-Encoder-3.002_002 Sereal-Encoder-3.002_001 Sereal-Encoder-3.002 Sereal-Encoder-3.001_012 Sereal-Encoder-3.001_011 Sereal-Encoder-3.001_009 Sereal-Encoder-3.001_008 Sereal-Encoder-3.001_007 Sereal-Encoder-3.001_006 Sereal-Encoder-3.001_005 Sereal-Encoder-3.001_004 Sereal-Encoder-3.001_003 Sereal-Encoder-3.001_002 Sereal-Encoder-3.001_001 Sereal-Encoder-3.001 Sereal-Encoder-3.000_004 Sereal-Encoder-3.000_003 Sereal-Encoder-3.000_002 Sereal-Encoder-3.000_001 Sereal-Encoder-2.070_103 Sereal-Encoder-2.070_102 Sereal-Encoder-2.070_101 Sereal-Encoder-2.12 Sereal-Encoder-2.11 Sereal-Encoder-2.10 Sereal-Encoder-2.09 Sereal-Encoder-2.08 Sereal-Encoder-2.07_01 Sereal-Encoder-2.06 Sereal-Encoder-2.04 Sereal-Encoder-2.03 Sereal-Encoder-2.02 Sereal-Encoder-2.01 Sereal-Encoder-2.00_03 Sereal-Encoder-2.00_02 Sereal-Encoder-2.00_01 Sereal-Encoder-0.37 Sereal-Encoder-0.36 Sereal-Encoder-0.35 Sereal-Encoder-0.34 Sereal-Encoder-0.33 Sereal-Encoder-0.32 Sereal-Encoder-0.31 Sereal-Encoder-0.30
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Erlang/Sereal use unsigned char Jun 15, 2016
Go Add "make check" target as alias for "make test" for java and golang Mar 29, 2018
Java add option to force byte values as strings Sep 5, 2018
Perl Fix for Typo in POD Jul 26, 2018
ruby synchronize all the snappy code Jul 13, 2016
travis cleanup dependencies Nov 12, 2017
util add a tool to sync snappy code to the different language dirs Jul 13, 2016
.gitignore Add simple encoder/decoder benchmarks Mar 2, 2016
.travis.yml travis: upgrade to container-based testing Dec 2, 2015
README.pod Fix README error Mar 24, 2016



Sereal - A binary serialization format


This repository is the home of the Sereal data serialization format. This format was started because the authors had technical reasons for producing a better Storable.

Before we embarked on this project we had a look at various prior art. This included a review of Google Protocol Buffers and of the MessagePack protocol. Neither suited our needs so we designed this, liberally borrowing ideas from the other projects.




We wanted to be able to serialize shared references properly. Many serialization formats do not support this out of the box.

Weak References

Given that perl uses a reference counting garbage collection scheme, Perl has the concept of a special type of reference called a "weakref" which is used to create cyclic reference structures which do not leak memory. Unlike most of the existing solutions, we need to handle these structures correctly, thus avoiding a perfectly valid data structure to be converted to one that will cause a memory leak on a remote system. For cross-language compatibility, weak references can very easily be ignored by other decoder implementations.


Perl supports aliases. These are a special kind of reference which is effectively a C level pointer instead of a Perl language-level reference. We needed to be able to represent these as well.


Promoting a plain data structure reference to an object, as is customary in dynamic languages, can be dangerous in some circumstances. We needed to be able to serialize objects safely and reliably, and we wanted a sane control mechanism for doing so.

Regular Expression Objects

In Perl, a regular expression is a native type. We wanted to be able serialize these at a native level without losing data such as modifiers.

Space Efficiencies

We want to be able to represent common structures as small as is reasonable. Although not to the extreme that this makes the protocol error prone and ludicrously difficult to implement. The steps taken include removing redundancy from the serialized structure (such as hash keys or classnames) automatically. The protocol supports this kind of redundancy removal, but an encoder implementation can choose to which extent it makes use of the technique.

Speed Efficiencies

We want to be able to serialize and deserialize quickly. Some of the design decisions and trade-offs were aimed squarely at performance.

Separate Decoder and Encoder

We wanted to separate the functions of serializing from deserializing so they could be upgraded independently.

Forward/Backward Compatibility

We wanted the protocol to be robust to forward/backwards compatibility issues. It should be possible to partially read new formats with an old decoder, and output old formats with a new encoder.

Language Agnosticism

We want the format to be usable by other languages, especially dynamic languages. In aim of making this easier we have structured our repo so that implementations from other languages can be easily added, and we would welcome any contributions along these lines.

Performance Analysis

There are some graphs of how the Perl implementations Sereal performs as compared to the alternatives at Sereal Performance Graphs


You can find the specification at sereal_spec.pod


There is a low-traffic announcement mailing list sereal-announce as well as a more general development list sereal-dev


Yves Orton <>

Damian Gryski <>

Steffen Mueller <>

Rafaël Garcia-Suarez

Ævar Arnfjörð Bjarmason <>


This protocol was originally developed for With approval from, the code and specification were generalized and published as Open Source on github and CPAN, for which the authors would like to express their gratitude.


Copyright (C) 2012, 2013, 2014 by Steffen Mueller

Copyright (C) 2012, 2013, 2014 by Yves Orton