Currently, we omit empty next slab ID in encoded root data slabs because next slab ID is always empty in root data slabs.
However, next slab ID is also empty for non-root data slabs if the non-root data slab is the last data slab.
This commit sets hasNextSlabID flag during encoding and only encodes non-empty next slab ID for array data slab.
This change saves 16 bytes for the last non-root data slabs. Also, we don't special case the omission of next slab ID in root slabs.
NOTE: omission of empty next slab ID doesn't affect slab size computation which is used for slab operations, such as splitting and merging. This commit is a size optimization during slab encoding.
[ ] Targeted PR against main branch
[ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work
Updates #292 https://github.com/onflow/flow-go/issues/1744
Changes:
Currently, we omit empty next slab ID in encoded root data slabs because next slab ID is always empty in root data slabs.
However, next slab ID is also empty for non-root data slabs if the non-root data slab is the last data slab.
This commit sets hasNextSlabID flag during encoding and only encodes non-empty next slab ID for array data slab.
This change saves 16 bytes for the last non-root data slabs. Also, we don't special case the omission of next slab ID in root slabs.
NOTE: omission of empty next slab ID doesn't affect slab size computation which is used for slab operations, such as splitting and merging. This commit is a size optimization during slab encoding.
main
branchFiles changed
in the Github PR explorer