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

Array copy optimization #1487

merged 1 commit into from Jun 25, 2019


Copy link

@charles-cooper charles-cooper commented Jun 19, 2019

What I did

Optimize compiler-generated array copies. Depends on #1479 because of a conflict

How I did it

Remove bounds checks for when a loop is compiler-generated.

How to verify it

Check before/after IR for this contract

BIG_VALUE: constant(uint256) = 100

def do_work(a: uint256[BIG_VALUE]):
    assert self != msg.sender

def do_something(a: uint256[BIG_VALUE]):

Description for the changelog

Optimize compiler-generated array copies

Cute Animal Picture

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

Copy link

@jacqueswww jacqueswww commented Jun 21, 2019

@charles-cooper I am not sure the description matches the code?
ie. where is the array copy optimisation?

Copy link
Collaborator Author

@charles-cooper charles-cooper commented Jun 21, 2019

@jacqueswww I force pushed so the diff is cleaner now. The array bounds check is elided in the make_setter loop now, so instead of

for (i = 0; i < len; i++) {
  dst[uclamplt(i, len)] = src[uclamplt(i, len)]

it is now effectively

for (i = 0; i < len; i++) {
  dst[i] = src[i]

@charles-cooper charles-cooper changed the title WIP: Array copy optimization Array copy optimization Jun 21, 2019
@jacqueswww jacqueswww merged commit b7f9750 into vyperlang:master Jun 25, 2019
3 checks passed
@charles-cooper charles-cooper deleted the array_copy_optimization branch Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants