Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slab size when resetting mutable storable in Array #336

Merged

Conversation

fxamacker
Copy link
Member

@fxamacker fxamacker commented Sep 4, 2023

Updates #292 #335

Changes

Recompute slab size by adding all element sizes instead of using the size diff of old
and new element because oldElem can be the same storable when the same value is reset
and oldElem.ByteSize() can equal storable.ByteSize().

Given this, size diff of the old and new element can be 0 even when its actual size changed.

This is prep work for atree inlining to prevent a bug from surfacing.


  • Targeted PR against main branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@fxamacker fxamacker self-assigned this Sep 4, 2023
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.08% 🎉

Comparison is base (74e19aa) 65.24% compared to head (dda0495) 65.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #336      +/-   ##
==========================================
+ Coverage   65.24%   65.32%   +0.08%     
==========================================
  Files          14       14              
  Lines        8761     8773      +12     
==========================================
+ Hits         5716     5731      +15     
+ Misses       2327     2325       -2     
+ Partials      718      717       -1     
Files Changed Coverage Δ
array.go 70.69% <100.00%> (+0.15%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ramtinms ramtinms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, Just to confirm my understanding this only iterates over the size of values of the current slab and nothing beyond that? if for example we have an array with many underlying slabs, changes in one element doesn't require the whole array to go and scan all the slabs ?

@fxamacker
Copy link
Member Author

@ramtinms

looks good to me, Just to confirm my understanding this only iterates over the size of values of the current slab and nothing beyond that? if for example we have an array with many underlying slabs, changes in one element doesn't require the whole array to go and scan all the slabs ?

Yes, this only iterates over the sizes of elements in current slab. It doesn't require scanning of the whole array.

…tting-same-storable-in-map

Fix slab size when resetting mutable storable in OrderedMap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants