2019-06-13 15:22:24 +00:00
|
|
|
contract C {
|
2019-09-18 13:38:38 +00:00
|
|
|
uint[] storageArray;
|
|
|
|
function test_indices(uint256 len) public
|
|
|
|
{
|
2019-11-18 13:36:45 +00:00
|
|
|
while (storageArray.length < len)
|
|
|
|
storageArray.push();
|
|
|
|
while (storageArray.length > len)
|
|
|
|
storageArray.pop();
|
2019-09-18 13:38:38 +00:00
|
|
|
for (uint i = 0; i < len; i++)
|
|
|
|
storageArray[i] = i + 1;
|
2019-06-13 15:22:24 +00:00
|
|
|
|
2019-09-18 13:38:38 +00:00
|
|
|
for (uint i = 0; i < len; i++)
|
|
|
|
require(storageArray[i] == i + 1);
|
|
|
|
}
|
2019-06-13 15:22:24 +00:00
|
|
|
}
|
2019-11-07 20:22:58 +00:00
|
|
|
// ====
|
2020-11-24 23:25:42 +00:00
|
|
|
// compileViaYul: also
|
2019-06-13 15:22:24 +00:00
|
|
|
// ----
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
|
|
|
// test_indices(uint256): 129 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 3032985
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 3070431
|
|
|
|
// gas legacyOptimized: 3010325
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 5 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 367641
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 369211
|
|
|
|
// gas legacyOptimized: 366089
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 10 ->
|
|
|
|
// test_indices(uint256): 15 ->
|
2021-09-15 15:01:40 +00:00
|
|
|
// gas irOptimized: 72860
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 0xFF ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 3438609
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 3512637
|
|
|
|
// gas legacyOptimized: 3395047
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1000 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 18318371
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 18611999
|
|
|
|
// gas legacyOptimized: 18166944
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 129 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 2733569
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 2771961
|
|
|
|
// gas legacyOptimized: 2714999
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 128 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 426681
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 466504
|
|
|
|
// gas legacyOptimized: 416888
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
2022-01-14 12:37:40 +00:00
|
|
|
// gas irOptimized: 363073
|
2022-03-07 18:13:35 +00:00
|
|
|
// gas legacy: 363401
|
|
|
|
// gas legacyOptimized: 361799
|