Skip to content

Optimization for multiple memory-zeroing instructions#2174

Merged
fubuloubu merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-mzero
Sep 30, 2020
Merged

Optimization for multiple memory-zeroing instructions#2174
fubuloubu merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-mzero

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

Add an optimization for zeroing multiple memory slots at once.

Closes #2144

How I did it

When the LLL contains multiple sequential instructions to MSTORE n 0 or CALLDATACOPY m CALLDATALSIZE n, and the locations being zero'd within memory are sequential, merge these instructions into a single zeroing via calldatacopy.

How to verify it

Run tests.

Cute Animal Picture

image

@codecov-commenter

codecov-commenter commented Sep 29, 2020

Copy link
Copy Markdown

Codecov Report

Merging #2174 into master will increase coverage by 0.04%.
The diff coverage is 96.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2174      +/-   ##
==========================================
+ Coverage   85.25%   85.29%   +0.04%     
==========================================
  Files          83       83              
  Lines        8367     8397      +30     
  Branches     2019     2029      +10     
==========================================
+ Hits         7133     7162      +29     
  Misses        732      732              
- Partials      502      503       +1     
Impacted Files Coverage Δ
vyper/optimizer.py 83.33% <96.66%> (+3.92%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b5669d...e1c195f. Read the comment docs.

@fubuloubu fubuloubu merged commit 928ba7f into vyperlang:master Sep 30, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the optimize-mzero branch September 30, 2020 16:33
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.

Optimize zero-value memory variable declarations using CALLDATACOPY

3 participants