Cart

Subtotal : $20.00

Shipping : $7.00

Taxes : $0.00

Sub Total : 00.00

Call us:

(+800)345678

Rust: The joy of safe zero-copy parsers

In the context of computer science, parsers are programs or algorithms that can translate a given bulk of data into some kind of structured information. When talking about inter-device communication (e.g.: How this article has been sent to your device), parsers are used to convert the received data into something the device can process.

An example of how an HTML website is processed by your computer. Author: Erwin Hofman

Bearing that in mind, it’s quite easy to understand the importance of such algorithms, as well as how their efficiency may be a critical part of the overall performance of a system. That being said, one of the ways of optimizing such programs is the use of a technique called zero-copy.

A zero-copy parser is a piece of code that can transform the received data into its structured form, without having to copy its contents into new buffers during this procedure. As such, these kinds of parsers differ from others when parts of the data have to be translated into a collection of values (e.g.: Strings and arrays); as non-zero-copy programs would allocate a new region in the heap and then copy the respective part of the received data into it.