AleoNet / snarkVM

A Virtual Machine for Zero-Knowledge Executions

Home Page:https://snarkvm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimizations to struct deserialization

raychu86 opened this issue · comments

We currently have an optimization in deserializing BatchCertificates by parallelizing the deserialization of signatures -
https://github.com/AleoHQ/snarkVM/blob/1969efc3747256c7b5837bce7d33bb7489308f87/ledger/narwhal/batch-certificate/src/bytes.rs#L39-L44

We can apply this technique to other places where we know the internal object being deserialized has a fixed size. Some examples are:

Previous certificates in BatchHeader - https://github.com/AleoHQ/snarkVM/blob/1969efc3747256c7b5837bce7d33bb7489308f87/ledger/narwhal/batch-header/src/bytes.rs#L64-L68

Members in a Committee - https://github.com/AleoHQ/snarkVM/blob/1969efc3747256c7b5837bce7d33bb7489308f87/ledger/committee/src/bytes.rs#L42-L50

This will help improve the message processing speed of nodes because all messages sent through the network must be deserialized from bytes.

Additional note: If possible, applying a more sophisticated version of this optimization to lists where the internal object does not have a fixed size, would have an even more significant impact on performance.

Closing with #2395