Created
April 10, 2019 11:37
-
-
Save eternauta1337/9ff33cffa62c52f63f387a1569834dc1 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
This file contains hidden or 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.5.0; | |
contract Loopy { | |
// 7750 gas | |
// 5732 gas (optimized) | |
function loop_1() public pure returns (uint acum) { | |
for(uint i = 0; i < 100; i++) { | |
acum++; | |
} | |
} | |
// 6728 gas | |
// 5710 gas (optimized) | |
function loop_2() public pure returns (uint acum) { | |
for(uint i = 0; i < 100; ++i) { | |
++acum; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment