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

feat: optimize dload/mstore sequences #3525

Merged
merged 4 commits into from
Jul 23, 2023

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jul 20, 2023

What I did

How I did it

How to verify it

Commit message

merge_dload was defined in 5dc3ac7, but was not applied.

this commit also adds a rewrite rule for single dload/mstore patterns,
any `(mstore dst (dload src))` (which compiles to a `codecopy` followed
by an `mload` and `mstore`) is rewritten to a `dloadbytes` (which
compiles directly to a `codecopy`).

this rule saves 4 bytes / ~10 gas per rewrite. for instance, it shaves
25 bytes off `VaultV3.vy`, 50 bytes off `CurveTricryptoOptimizedWETH.vy`
and 75 bytes off `CurveStableSwapMetaNG.vy` (basically 0.1%-0.3%).

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

merge_dload was defined in 5dc3ac7, but was not applied. this commit
fixes that.
@charles-cooper charles-cooper changed the title chore: apply merge_dload chore: apply merge_dload Jul 20, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2023

Codecov Report

Merging #3525 (2082fcf) into master (9e3b9a2) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3525      +/-   ##
==========================================
+ Coverage   89.16%   89.18%   +0.02%     
==========================================
  Files          84       84              
  Lines       10953    10970      +17     
  Branches     2503     2506       +3     
==========================================
+ Hits         9766     9784      +18     
+ Misses        775      774       -1     
  Partials      412      412              
Impacted Files Coverage Δ
vyper/ir/optimizer.py 98.30% <100.00%> (+0.35%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

it's always better for (mstore dst (dload src)) to be rewritten with
dloadbytes.
@charles-cooper charles-cooper changed the title chore: apply merge_dload feat: optimize dload sequences Jul 23, 2023
@charles-cooper charles-cooper changed the title feat: optimize dload sequences feat: optimize dload/mstore sequences Jul 23, 2023
@charles-cooper charles-cooper enabled auto-merge (squash) July 23, 2023 21:44
@charles-cooper charles-cooper merged commit 299352e into vyperlang:master Jul 23, 2023
75 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants