[TEMP ON HOLD] refactor: Use SBOR raw value across engine for better worst case performance#1860
Draft
[TEMP ON HOLD] refactor: Use SBOR raw value across engine for better worst case performance#1860
Conversation
Benchmark for bd69b0eClick to view benchmark
|
|
Docker tags |
5c69067 to
21877eb
Compare
6c066ac to
5e80b55
Compare
dhedey
added a commit
that referenced
this pull request
Aug 9, 2024
benches: Explicit benches relevant to #1860
This was referenced Aug 15, 2024
This file contains hidden or 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
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.
Note
This PR is massive and never quite got finished or reviewed and now has a mountain of merge conflicts. Instead, I suggest we proceed by:
Summary
Looks to address #1708 and historic issues with
ScryptoValue- by replacingScryptoValuewith variants ofScryptoRawValueon the critical paths in the engine.Notably, compare these benchmarks from #1870 with after this PR:
This is due to quite a few places in the System layer where we were decoding as
ScryptoValueas the value part of System wrappers. We've knownScryptoValuecan be very slow to decode for a while; particularlyVec<u8>. And whilst we should improve that (as Bartosz recommends), usingScryptoRawValueshould be faster/safer.Instead:
ScryptoRawValue/ScryptoRawPayload, which decodes much more quickly in the common worst case of largeVec<u8>.Vec<u8>flying around, we now have concrete new types for whether things have been validated or not.IndexedOwnedScryptoValuefromIndexedScryptoValue<'a>where the latter doesn't necessarily own its value.Still to come:
FieldValueandKVEntryto beScryptoUnvalidatedOwnedRawPayloadand fixSystemObjectApietc (git stash pop)SborUnvalidatedOwnedRawPayloadinstead ofSborUnvalidatedOwnedRawValueSborRawValueand check it when encodingSborRawValue/SborRawPayloadSborRawPayloadwhen encoding assbor_raw_payloadso it can be converted more performantly toSborRawValue.traverser/calculate_value_tree_body_byte_lengthas best we can to eek out even more performance.Details
TODO
Testing
Unit tests on
encoded_wrappers.rsto comeUpdate Recommendations
TODO