Gas Optimization #40
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Gas Report
[Gas-01] Caching array length can save gas
Caching the array length is more gas efficient. This is because access to a local variable in solidity is more efficient than query storage / calldata / memory. We recommend to cache the array length as a local variable and use it instead of array.length.
[Gas-02] Prefix increments are cheaper than postfix increments
Prefix increments are cheaper than postfix increments. Further more, using unchecked {++x} is even more gas efficient, and the gas saving accumulates every iteration and can make a real change
[Gas-03] Unnecessary default assignment
Unnecessary default assignments, you can just declare and it will save gas and have the same meaning.
The text was updated successfully, but these errors were encountered: