# \[ANN\] data-encoding.0.3: performances and streaming

**URL:** <https://discuss.ocaml.org/t/ann-data-encoding-0-3-performances-and-streaming/7205>\
**Category:** Community\
**Tags:** announce\
**Created:** [February 4, 2021, 9:20am UTC](https://discuss.ocaml.org/t/ann-data-encoding-0-3-performances-and-streaming/7205 "2021-02-04T09:20:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![raphael-proust](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/raphael-proust/32/415_2.png) [@raphael-proust](https://discuss.ocaml.org/u/raphael-proust)\
**Post date:** [February 4, 2021, 9:28am UTC](https://discuss.ocaml.org/t/ann-data-encoding-0-3-performances-and-streaming/7205/2 "2021-02-04T09:28:59Z")

</div>

> [@raphael-proust](#):
>
> More details below.

According to the micro-benchmark below data-encoding.0.3 gets close to `Marshal` performances on the serialising and deserialising of Micheline values (S-EXP-like values used to represent smart-contracts on the Tezos blockchain).

> **[Bench Micheline serialization ($2060331) · Snippets · Nomadic Labs /...](https://gitlab.com/nomadic-labs/data-encoding/-/snippets/2060331)**
>
> A library for encoding and decoding data. It offers a great degree of control over the layout of data. It supports json and binary serialisation/deserialisation. Doc :

The results are printed below. Notice the speed up:

- for serialising it progressed from a 13.40× slow-down over Marshal to a 1.01× slow-down,
- for deserialising it progressed from a 18.72× slow-down over Marshal to a 1.02× slow-down.

```auto
* data-encoding 0.2
Estimated testing time 20s (2 benchmarks x 10s). Change using '-quota'.
┌────────────────┬──────────┬────────────┬─────────────────┬──────────┬───────────┬───────────┬────────────┬─────────┐
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │ Speedup │
├────────────────┼──────────┼────────────┼─────────────────┼──────────┼───────────┼───────────┼────────────┼─────────┤
│ marshal_encode │ 1.00 │ 102.89us │ -0.05us +0.06us │ 5.74kw │ 0.11w │ 0.11w │ 7.46% │ 1.00 │
│ binary_encode │ 1.00 │ 1_378.70us │ -7.47us +8.73us │ 953.58kw │ 1_489.94w │ 1_489.94w │ 100.00% │ 13.40 │
└────────────────┴──────────┴────────────┴─────────────────┴──────────┴───────────┴───────────┴────────────┴─────────┘
Estimated testing time 20s (2 benchmarks x 10s). Change using '-quota'.
┌────────────────┬──────────┬────────────┬─────────────────┬──────────┬───────────┬───────────┬────────────┬─────────┐
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │ Speedup │
├────────────────┼──────────┼────────────┼─────────────────┼──────────┼───────────┼───────────┼────────────┼─────────┤
│ marshal_decode │ 1.00 │ 73.58us │ -0.62us +0.59us │ 7.59kw │ 0.16w │ 0.16w │ 5.34% │ 1.00 │
│ binary_decode │ 1.00 │ 1_377.68us │ -4.26us +4.35us │ 951.99kw │ 1_464.25w │ 1_464.25w │ 100.00% │ 18.72 │
└────────────────┴──────────┴────────────┴─────────────────┴──────────┴───────────┴───────────┴────────────┴─────────┘
* data-encoding 0.3
┌────────────────┬──────────┬──────────┬─────────────────┬─────────┬──────────┬──────────┬────────────┬─────────┐
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │ Speedup │
├────────────────┼──────────┼──────────┼─────────────────┼─────────┼──────────┼──────────┼────────────┼─────────┤
│ marshal_encode │ 1.00 │ 102.05us │ -0.15us +0.18us │ 5.74kw │ 0.11w │ 0.11w │ 99.40% │ 1.00 │
│ binary_encode │ 1.00 │ 102.67us │ -0.39us +0.44us │ 37.55kw │ 2.55w │ 2.55w │ 100.00% │ 1.01 │
└────────────────┴──────────┴──────────┴─────────────────┴─────────┴──────────┴──────────┴────────────┴─────────┘
Estimated testing time 20s (2 benchmarks x 10s). Change using '-quota'.
┌────────────────┬──────────┬──────────┬─────────────────┬─────────┬──────────┬──────────┬────────────┬─────────┐
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │ Speedup │
├────────────────┼──────────┼──────────┼─────────────────┼─────────┼──────────┼──────────┼────────────┼─────────┤
│ marshal_decode │ 1.00 │ 72.21us │ -0.29us +0.33us │ 7.59kw │ 0.16w │ 0.16w │ 97.57% │ 1.00 │
│ binary_decode │ 1.00 │ 74.00us │ -0.29us +0.31us │ 36.48kw │ 2.89w │ 2.89w │ 100.00% │ 1.02 │
└────────────────┴──────────┴──────────┴─────────────────┴─────────┴──────────┴──────────┴────────────┴─────────┘

```

* * *

Do not hesitate to open an issue on [the project’s issue tracker](https://gitlab.com/nomadic-labs/data-encoding/-/issues) to let us know about encodings that are still too slow.

---

_[View the full topic](https://discuss.ocaml.org/t/ann-data-encoding-0-3-performances-and-streaming/7205)._
