15,000 USDC
View results
Submission Details
Severity: gas

Cache array length outside of loop

Cache array length outside of loop

If not cached, the solidity compiler will read the length of the array from storage during each iteration, that is an extra unnecessary sload operation on each iteration as the length of this array doesn't change during the execution of the loop and can be avoided by saving the length into memory outside of the for block.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.