2019-06-06 12:07:40 +00:00
|
|
|
contract C {
|
2019-09-18 13:38:38 +00:00
|
|
|
uint[] storageArray;
|
2019-11-07 20:22:58 +00:00
|
|
|
function set_get_length(uint256 len) public returns (uint256) {
|
|
|
|
while(storageArray.length < len)
|
|
|
|
storageArray.push();
|
2019-09-18 13:38:38 +00:00
|
|
|
return storageArray.length;
|
|
|
|
}
|
2019-06-06 12:07:40 +00:00
|
|
|
}
|
|
|
|
// ====
|
2020-11-24 23:25:42 +00:00
|
|
|
// compileViaYul: also
|
2019-06-06 12:07:40 +00:00
|
|
|
// ----
|
|
|
|
// set_get_length(uint256): 0 -> 0
|
|
|
|
// set_get_length(uint256): 1 -> 1
|
|
|
|
// set_get_length(uint256): 10 -> 10
|
|
|
|
// set_get_length(uint256): 20 -> 20
|
|
|
|
// set_get_length(uint256): 0xFF -> 0xFF
|
2021-03-19 13:25:19 +00:00
|
|
|
// gas irOptimized: 434427
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 619622
|
|
|
|
// gas legacyOptimized: 600718
|
2019-09-18 13:38:38 +00:00
|
|
|
// set_get_length(uint256): 0xFFF -> 0xFFF
|
2021-03-19 13:25:19 +00:00
|
|
|
// gas irOptimized: 6743189
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 9765519
|
|
|
|
// gas legacyOptimized: 9461820
|
2019-12-04 12:13:05 +00:00
|
|
|
// set_get_length(uint256): 0xFFFFF -> FAILURE # Out-of-gas #
|