The linked for loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X).
Example:
for (uint80 i = 1; i < iterationCount; ++i) {
Recommendation:
We advise the increment / decrement operation to be performed in an unchecked code block as the last statement within the for loop to optimize its execution cost.
OHR-03C: Loop Iterator Optimization
Description:
The linked
for
loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X
).Example:
Recommendation:
We advise the increment / decrement operation to be performed in an
unchecked
code block as the last statement within thefor
loop to optimize its execution cost.