-
-
Save DadeKuma/931ce6794a050201ec6544dbcc31316c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity =0.8.19; | |
contract Gas { | |
// 37 | |
function notOptimized(bool a, bool b) external returns(uint gasUsed){ | |
uint startGas = gasleft(); | |
if(a && b) { | |
} | |
gasUsed = startGas - gasleft(); | |
} | |
// 7 | |
function optimized(bool a, bool b) external returns(uint gasUsed){ | |
uint startGas = gasleft(); | |
if(a) { | |
if(b) { | |
} | |
} | |
gasUsed = startGas - gasleft(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment