At the moment BlockExtra contains a bitcoin::Block
There are cases when you are interested only in a small fraction of the block and paying the cost of allocating all the block objects could impact performance. In other words, the cases where bitcoin_slices make sense.
What could help would be a BlockExtra version with Vec<u8> instead of a Block so that the downstream user could avoid instantiating a Block and use a bitcoin_slices::Visitor instead.
We have the byte size of the Block in BlockExtra, however in the binary format it appears after the block data, thus we cannot "skip" block parsing that is variable lenght.
Binary format version 1 could instead write the size before the Block so that if the user require the faster version could simply allocate a single Vec<u8> for the block .
steps:
At the moment
BlockExtracontains abitcoin::Blockblocks_iterator/src/block_extra.rs
Line 17 in 73812b9
There are cases when you are interested only in a small fraction of the block and paying the cost of allocating all the block objects could impact performance. In other words, the cases where bitcoin_slices make sense.
What could help would be a
BlockExtraversion withVec<u8>instead of aBlockso that the downstream user could avoid instantiating aBlockand use abitcoin_slices::Visitorinstead.We have the byte size of the
BlockinBlockExtra, however in the binary format it appears after the block data, thus we cannot "skip" block parsing that is variable lenght.Binary format version 1 could instead write the size before the Block so that if the user require the faster version could simply allocate a single
Vec<u8>for the block .steps: