Increments can be unchecked in loops
Summary
Unchecked operations as the ++i on for loops are cheaper than checked one.
Details
In Solidity 0.8+, there’s a default overflow check on unsigned integers. It’s possible to uncheck this in for-loops and save some gas at each
iteration, but at the cost of some code readability, as this uncheck cannot be made inline..
The code would go from:
to
The risk of overflow is inexistent for a uint256 here.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.