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-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
|
|
|
// test_indices(uint256): 129 ->
|
2022-09-15 10:19:18 +00:00
|
|
|
// gas irOptimized: 3020710
|
2022-11-08 16:07:36 +00:00
|
|
|
// gas legacy: 3071683
|
|
|
|
// gas legacyOptimized: 3014415
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 5 ->
|
2022-11-09 09:20:37 +00:00
|
|
|
// gas irOptimized: 578008
|
|
|
|
// gas legacy: 575321
|
|
|
|
// gas legacyOptimized: 572912
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 10 ->
|
2022-09-15 10:19:18 +00:00
|
|
|
// gas irOptimized: 158347
|
2022-11-08 16:07:36 +00:00
|
|
|
// gas legacy: 162657
|
|
|
|
// gas legacyOptimized: 158422
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 15 ->
|
2022-09-15 10:19:18 +00:00
|
|
|
// gas irOptimized: 173377
|
2022-11-08 16:07:36 +00:00
|
|
|
// gas legacy: 179782
|
|
|
|
// gas legacyOptimized: 173727
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 0xFF ->
|
2022-09-15 10:19:18 +00:00
|
|
|
// gas irOptimized: 5680122
|
2022-11-08 16:07:36 +00:00
|
|
|
// gas legacy: 5780977
|
|
|
|
// gas legacyOptimized: 5668997
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1000 ->
|
2022-09-15 10:19:18 +00:00
|
|
|
// gas irOptimized: 18202919
|
2022-11-08 16:07:36 +00:00
|
|
|
// gas legacy: 18602799
|
|
|
|
// gas legacyOptimized: 18179744
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 129 ->
|
2022-11-09 09:20:37 +00:00
|
|
|
// gas irOptimized: 4158223
|
|
|
|
// gas legacy: 4169611
|
|
|
|
// gas legacyOptimized: 4126312
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 128 ->
|
2022-11-09 09:20:37 +00:00
|
|
|
// gas irOptimized: 411932
|
|
|
|
// gas legacy: 465768
|
|
|
|
// gas legacyOptimized: 418968
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
2022-11-09 09:20:37 +00:00
|
|
|
// gas irOptimized: 581570
|
|
|
|
// gas legacy: 577432
|
|
|
|
// gas legacyOptimized: 576168
|