Load array length in memory before looping
0xbok opened this issue · comments
In cases like these, we can do:
uint256 len = extraRewards.length;
for (uint256 i = 0; i < len; i++) {
After updating all cases like these, brownie test --gas
showed gas savings.
removeExtraReward isn't going to be called often, can you find other places where these changes can save gas?
Yes, here are the places we can make this change: https://github.com/0xbok/veYfi/commit/0438a34a25c78f8918832c2ec56073642a88948d
Can you create a PR, pay attention and please remove the linting changes.