We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throughout the code, there are potential areas to improve gas usage. These changes are minor and may not always be a massive change.
These changes aim for Crab v2, but can be applied elsewhere.
!= 0
> 0
uint256
require
Source
Saves 6 gas/call
Present In:
Depending on whether the array is from storage, memory, or calldata, it can shave off gas usage per loop.
In Solidity, values when not defined will have a zero-equivalent and thus, setting = 0 or other zero-equivalent is unnecessary and costs gas.
= 0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Throughout the code, there are potential areas to improve gas usage. These changes are minor and may not always be a massive change.
These changes aim for Crab v2, but can be applied elsewhere.
Types of Gas Optimizations
Usage of
!= 0
is gas-efficient over> 0
when used on auint256
in arequire
statementSource
Saves 6 gas/call
Present In:
Cache the Array's Length
Depending on whether the array is from storage, memory, or calldata, it can shave off gas usage per loop.
Present In:
Unnecessary Zero-Initialization
In Solidity, values when not defined will have a zero-equivalent and thus, setting
= 0
or other zero-equivalent is unnecessary and costs gas.Present In:
The text was updated successfully, but these errors were encountered: