Serialization

Communications with the Pyhton Stages currently require all messages to be serializable through the rbuf system. It’s assumed that you are using rbufs for your serialization format.

The rbufc compiler and build system will take care of compiling your rbufs into native Python code. Note that we are not presently using C++ bindings for this, which has a runtime performance impact. We are generally about 20-30% slower then Pickle, depending on the structures being sent over the wire.

Expect performance to improve over time.

Useful APIs

APIs for serialization/deserialization generally match their JavaScript or C++ counterparts.

For example:

from pyserialize import serialize, deserialize

from my_message_rbuf import MyMessage

my_message = MyMessage()

bytes = serialize(my_message)
roundtrip = deserialize(MyMessage, bytes)

At this point, my_message and roundtrip will contain the same content. Under the hood, we’re using the same InputStream and OutputStream constructs that the other languages use.

See the main serialization docs for more information.