Recommendation:
We advise the statements within the for loop limits to be relocated outside to a local variable declaration that is consequently utilized for the evaluations to significantly reduce the codebase's gas cost. We should note the same optimization is applicable for storage reads present in those limits as they are newly read on each iteration (i.e. length members of arrays in storage).
This seems to me like a basic compiler optimization, are you sure that solc+pragma >8.20 does not take care of it already?
This seems to me like a basic compiler optimization, are you sure that solc+pragma >8.20 does not take care of it already?