solidity/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol

27 lines
676 B
Solidity
Raw Normal View History

contract C {
uint256[] storageArray;
function pushEmpty(uint256 len) public {
while(storageArray.length < len)
storageArray.push();
for (uint i = 0; i < len; i++)
require(storageArray[i] == 0);
}
}
// ====
// EVMVersion: >=petersburg
2021-02-12 12:45:15 +00:00
// compileViaYul: also
// ----
// pushEmpty(uint256): 128
2021-07-01 12:17:27 +00:00
// gas irOptimized: 414881
// gas legacy: 417287
// gas legacyOptimized: 399048
// pushEmpty(uint256): 256
2021-07-01 12:17:27 +00:00
// gas irOptimized: 706405
// gas legacy: 715083
// gas legacyOptimized: 688908
2021-05-25 11:09:48 +00:00
// pushEmpty(uint256): 38869 -> FAILURE # out-of-gas #
// gas irOptimized: 100000000
// gas legacy: 100000000
// gas legacyOptimized: 100000000