-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
The solidity compiler generates more code for βif (A && B) {}β than for βif (A) {if (B) {} }β.
Our experiment shows that switching from βif (A && B) {}β to βif (A) {if (B) {} }β can save gas fees.
There are two such cases:
| if (reserveA == 0 && reserveB == 0) { |
| if (reserveA == 0 && reserveB == 0) { |
Replacing
if (reserveA == 0 && reserveB == 0) {
with
if (reserveA == 0) {
if (reserveB == 0) {
can save gas fees and does not hurt code readability.
Metadata
Metadata
Assignees
Labels
No labels