diamond-3-hardhat icon indicating copy to clipboard operation
diamond-3-hardhat copied to clipboard

Slight for loop gas optimization

Open redsh4de opened this issue 2 years ago • 2 comments

  • Changed increment operations to use pre-increment instead of post-increment to save an extra operation
  • for loop iterator incrementing is moved into an unchecked block to skip overflow checks and save gas - given that i has a maximum limit set by the loop, there are no downsides for this approach

redsh4de avatar Jan 31 '23 21:01 redsh4de

@redsh4de I appreciate this. I found one bug in the pull request. Please fix and I can merge. Thanks for your help.

mudgen avatar Sep 17 '23 18:09 mudgen

That should take care of it! @mudgen

redsh4de avatar Sep 17 '23 19:09 redsh4de