Computer systems are designed to process information in the form of a binary stream of data. These strings consist of numbers and letters that must be

Speeding up incoming message parsing by 3- to 10-times by switching from serde to the nom library

submited by
Style Pass
2021-06-16 11:00:05

Computer systems are designed to process information in the form of a binary stream of data. These strings consist of numbers and letters that must be processed by parsers into an intelligible form that the system can use.

The same is true with data sent across the Tezos network. For example, with a ConnectionMessage we have port number, nonce, public key and proof of work stamp all in the form of one continuous string. To make sense of this, we must separate and decode the various pieces of information from this string of data, for which we use a parser.

Parsing is a necessary process in the TezEdge node, but it also introduces overhead in the form of additional code and memory. We want to minimize this overhead in order to make the process as efficient and secure as possible.

The serde-based encoding is the de facto standard for Rust and it has its own layout for correspondence between serialized bytes and Rust structures (encoding and decoding). However, the Tezos encoding we use has a different layout.

Leave a Comment