Gas Optimizations #7
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
invalid
This doesn't seem right
For-Loop :
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L506
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L525
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L547
1 - An array’s length should be cached to save gas in for-loops
Reading array length at each iteration of the loop takes 6 gas
2 - Increments can be unchecked and ++i costs less gas compared to i++
The code would go to :
The text was updated successfully, but these errors were encountered: