Omit empty next slab ID in encoded array data slab #339
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates #292 onflow/flow-go#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