-
Notifications
You must be signed in to change notification settings - Fork 140
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 storage format #797
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Switch from CBOR map to CBOR array to improve speed and preserve ordering. Remove key strings from encoding. Remove old backwards-compatibility decoding code. Add tests, including round-trip for decoding old format and encoding new format. Closes #743
Add error handling to check decoded dictionary array length. Incorporate feedback to replace append with direct assignment for an additional speed gain of 0.5-0.7% for encoding large data.
Switch from CBOR map to CBOR array to improve speed and preserve ordering. Remove unnecessary field sorting when decoding. Remove old backwards-compatibility decoding code (decoding type ID). Add tests, including round-trip for decoding old format and encoding new format. Closes #744
Optimize encoding by switch from CBOR map to CBOR array for: - StorageReferenceValue - PathValue - CapabilityValue - common.AddressLocation - LinkValue - CompositeStaticType - InterfaceStaticType - ConstantSizedStaticType - ReferenceStaticType - DictionaryStaticType - RestrictedStaticType - TypeValue Remove old backwards-compatibility decoding of type id in decodeCompositeStaticType() and decodeInterfaceStaticType() Add tests, including round-trip for decoding old format and encoding new format. Comparisons using LinkValue (that don't contain composites and dictionaries) show: name old time/op new time/op delta EncodeLink/link_167bytes-4 18.7µs ± 0% 9.5µs ± 0% -49.41% (p=0.000 n=10+10) EncodeLink/link_192bytes-4 19.1µs ± 0% 9.4µs ± 0% -50.56% (p=0.000 n=10+10) name old time/op new time/op delta DecodeLink/link_167bytes-4 10.6µs ± 0% 7.7µs ± 1% -26.87% (p=0.000 n=10+9) DecodeLink/link_192bytes-4 10.5µs ± 0% 7.7µs ± 0% -27.02% (p=0.000 n=10+10) Encoding comparisons using the same LinkValue show 57%-60% less memory use. Closes #764
Create benchmarks that use testdata/*.cbor.gz files. Add initial 6 *.cbor.gz files using data from a mainnet snapshot. For safety, limit number of files processed and use io.LimitReader to limit the max bytes uncompressed from each file. Closes #765
Use the current year for the copyright because it's a new file.
fxamacker
approved these changes
Apr 13, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Merge the implementation of #738
This is a merge of the feature branch consisting of previously reviewed PRs.
Kudos to @fxamacker for this fantastic work! 👏
master
branchFiles changed
in the Github PR explorer