Optimize calldataload#2352
Merged
fubuloubu merged 2 commits intoApr 15, 2021
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2352 +/- ##
==========================================
+ Coverage 85.84% 85.89% +0.04%
==========================================
Files 90 90
Lines 8791 8820 +29
Branches 2097 2103 +6
==========================================
+ Hits 7547 7576 +29
Misses 755 755
Partials 489 489
Continue to review full report at Codecov.
|
fubuloubu
approved these changes
Apr 15, 2021
skellet0r
added a commit
to skellet0r/curve-contract
that referenced
this pull request
Apr 19, 2021
Additional improvements to mitigate memory corruption bug in vyper. Additional optimizations. vyperlang/vyper#2345 vyperlang/vyper#2350 vyperlang/vyper#2352
skellet0r
added a commit
to skellet0r/curve-contract
that referenced
this pull request
Apr 29, 2021
Additional improvements to mitigate memory corruption bug in vyper. Additional optimizations. vyperlang/vyper#2345 vyperlang/vyper#2350 vyperlang/vyper#2352
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.
What I did
Optimize how calldata is loaded into memory.
How I did it
Within
optimizer.py, look for sequential instructions of e.g.This can be optimized to:
The optimization is applied with the same logic we use to optimize memory-zeroing actions:
mstoreinstructions that reference sequential calldata locations.calldatacopyHow to verify it
Run the tests. I didn't add any new specific cases, but this optimization is applied anywhere multiple input args are taken by an external function so if it weren't working we'd see things failing everywhere.
Cute Animal Picture