Giter Club home page Giter Club logo

sereal's Introduction

NAME

Sereal - A binary serialization format

SYNOPSIS

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.

DESCRIPTION

OBJECTIVES

References

We wanted to be able 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.

Aliases

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.

Objects

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. We hope to have a Java port soon, right Eric? 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

SPECIFICATION

You can find the specification at sereal_spec.pod

AUTHOR

Yves Orton <[email protected]>

Damian Gryski

Steffen Mueller <[email protected]>

Rafaël Garcia-Suarez

Ævar Arnfjörð Bjarmason

ACKNOWLEDGMENT

This protocol was originally developed for Booking.com. With approval from Booking.com, this module was generalized and published on CPAN, for which the authors would like to express their gratitude.

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Steffen Mueller

Copyright (C) 2012 by Yves Orton

sereal's People

Contributors

tsee avatar demerphq avatar niven avatar rgs avatar avar avatar audreyt avatar

Watchers

Reini Urban avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.