IntersectMBO / IntersectMBO/ouroboros-consensus
Optimise the implementation of GetNestedType
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
In input-output-hk/ouroboros-network#2226, we introduced a new `BlockComponent`, `GetNestedType`, which requires reading bytes the first `n` bytes from a block. When this is used in combination with other `BlockComponent` that require reading from the same file, we currently would open and close the same file twice, instead of keeping it open.
We can statically figure out whether a `BlockComponent` requires reading from a file and use that information to open the file once, in a scope higher than the one that interprets the `BlockComponent` query.
Moreover, if the first 0 bytes are requested (likely to be the case for pure Shelley in the future), we don't have to open the file at all.
Contributor guide
Assessment
This issue has not been assessed yet.