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
merged 1 commit into from Jun 25, 2019

Conversation

@charles-cooper
Copy link
Collaborator

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

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

@public
def do_something(a: uint256[BIG_VALUE]):
    self.do_work(a)

Description for the changelog

Optimize compiler-generated array copies

Cute Animal Picture

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

@jacqueswww

This comment has been minimized.

Copy link
Collaborator

jacqueswww commented Jun 21, 2019

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

@charles-cooper charles-cooper force-pushed the charles-cooper:array_copy_optimization branch from 17723a6 to c8cea1b Jun 21, 2019
@charles-cooper

This comment has been minimized.

Copy link
Collaborator Author

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
3 checks passed
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: py36-core Your tests passed on CircleCI!
Details
ci/circleci: py37-core Your tests passed on CircleCI!
Details
@charles-cooper charles-cooper deleted the charles-cooper: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
Projects
None yet
2 participants
You can’t perform that action at this time.