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-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 3018684
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 3068883
|
|
|
|
// gas legacyOptimized: 3011615
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 5 ->
|
2022-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 372540
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 369151
|
|
|
|
// gas legacyOptimized: 366139
|
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-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 3410252
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 3509577
|
|
|
|
// gas legacyOptimized: 3397597
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1000 ->
|
2022-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 18206119
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 18599999
|
|
|
|
// gas legacyOptimized: 18176944
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 129 ->
|
2022-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 2756952
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 2770413
|
|
|
|
// gas legacyOptimized: 2716289
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 128 ->
|
2022-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 411900
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 464968
|
|
|
|
// gas legacyOptimized: 418168
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
2022-08-10 16:45:38 +00:00
|
|
|
// gas irOptimized: 368568
|
2022-06-03 20:04:16 +00:00
|
|
|
// gas legacy: 363389
|
|
|
|
// gas legacyOptimized: 361809
|