Created
May 4, 2022 12:42
-
-
Save z0r0z/4187d4f39b9a2a6e89941f9f8e86682b 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
pragma solidity ^0.8.0; | |
contract Check { | |
function check0(address[] calldata stuff) external view returns (uint256) { | |
uint256 startGas = gasleft(); | |
uint256 counter; | |
for (uint256 i; i< stuff.length; i++) { | |
counter++; | |
} | |
return startGas - gasleft(); | |
} | |
function check1(address[] calldata stuff) external view returns (uint256) { | |
uint256 startGas = gasleft(); | |
uint256 counter; | |
uint256 len = stuff.length; | |
for (uint256 i; i< len; i++) { | |
counter++; | |
} | |
return startGas - gasleft(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment