IntersectMBO / IntersectMBO/ouroboros-network

Optimise CBOR-in-CBOR (de)serialisation

Open
#1,321 0 comments 0 reactions 0 assignees View on GitHub
optimisation
Dominant language
Haskell
Stars
296
Forks
104
Avg merge
2d 10h
Merged PRs (30d)
4

Description

The BlockFetch and ChainSync codecs both use CBOR-in-CBOR.
Encoding and decoding could be more efficient if we had `encodeEmbeddedCBOR` ([1]) ([2]) and `decodeEmbeddedCBOR` ([3]) ([4]).

Additionally, we could benefit from having a variant of `encodeBytes` that works for lazy bytestrings (e.g., `encodeBytesChunked`). In case the lazy bytestring contains multiple chunks, it first needs to be copied into one contiguous strict bytestring before it can be passed to `encodeBytes`. Avoiding that needless copy would be nice ([5]).

[1]: https://github.com/input-output-hk/ouroboros-network/blob/971b0b58d7833ac358aa8285ae6c58a00c3f22b9/ouroboros-network/src/Ouroboros/Network/Protocol/BlockFetch/Codec.hs#L94
[2]: https://github.com/input-output-hk/ouroboros-network/blob/971b0b58d7833ac358aa8285ae6c58a00c3f22b9/ouroboros-network/src/Ouroboros/Network/Protocol/ChainSync/Codec.hs#L135
[3]: https://github.com/input-output-hk/ouroboros-network/blob/971b0b58d7833ac358aa8285ae6c58a00c3f22b9/ouroboros-network/src/Ouroboros/Network/Protocol/BlockFetch/Codec.hs#L101
[4]: https://github.com/input-output-hk/ouroboros-network/blob/971b0b58d7833ac358aa8285ae6c58a00c3f22b9/ouroboros-network/src/Ouroboros/Network/Protocol/ChainSync/Codec.hs#L142
[5]: https://github.com/input-output-hk/ouroboros-network/pull/1271/files#r353642273

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.