-
Notifications
You must be signed in to change notification settings - Fork 12
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
Optimize max map value size to reduce number of registers #314
Optimize max map value size to reduce number of registers #314
Conversation
Previously, both max map key size and max map value size were the same (about half of max map element size). However, key size can be much smaller than max limit and max value size doesn't benefit from smaller key. Improve this by computing max map value size to subtract encoded key size from max map element size. So large value can be stored along with small key to reduce number of slabs. While at it, also replace exported settings with exported functions.
Codecov Report
@@ Coverage Diff @@
## main #314 +/- ##
==========================================
- Coverage 64.61% 64.59% -0.02%
==========================================
Files 14 14
Lines 7991 7997 +6
==========================================
+ Hits 5163 5166 +3
- Misses 2152 2156 +4
+ Partials 676 675 -1
|
Nice! Does this need a state migration? |
@turbolent Yes, this is part of prep work for Atree Register Inlining (#292) which requires migration anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea and improvement!
A lot of code will benefit from this, as it is very common that the keys are much smaller than the values 👌
This commit updates Cadence to use new Atree API - Array.Get() - OrderedMap.Get() - MaxInlineArrayElementSize() - MaxInlineMapKeySize() For more info, see Atree PRs: - onflow/atree#314 - onflow/atree#316 - onflow/atree#318
This commit updates Cadence to use new Atree API - Array.Get() - OrderedMap.Get() - MaxInlineArrayElementSize() - MaxInlineMapKeySize() For more info, see Atree PRs: - onflow/atree#314 - onflow/atree#316 - onflow/atree#318
Closes #313
Updates #296 #292 onflow/flow-go#1744
Description
Previously, both max map key size and max map value size were the same (about half of max map element size). However, key size can be much smaller than max limit and max value size didn't benefit from smaller key.
Optimize this by computing max map value size to subtract encoded key size from max map element size. So large value can be stored along with small key to reduce number of registers.
While at it, also replace exported settings with exported functions.
main
branchFiles changed
in the Github PR explorer