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 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 3016570
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 3069098
|
|
|
|
// gas legacyOptimized: 3013250
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 5 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 576716
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 574754
|
|
|
|
// gas legacyOptimized: 572383
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 10 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 158059
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 162468
|
|
|
|
// gas legacyOptimized: 158336
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 15 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 172984
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 179513
|
|
|
|
// gas legacyOptimized: 173606
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 0xFF ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 5672104
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 5775928
|
|
|
|
// gas legacyOptimized: 5666726
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1000 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 18173701
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 18583810
|
|
|
|
// gas legacyOptimized: 18171248
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 129 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 4147676
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 4164468
|
|
|
|
// gas legacyOptimized: 4122100
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 128 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 409209
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 463706
|
|
|
|
// gas legacyOptimized: 418061
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
2023-08-04 10:27:18 +00:00
|
|
|
// gas irOptimized: 580316
|
2023-04-26 11:03:17 +00:00
|
|
|
// gas legacy: 576904
|
|
|
|
// gas legacyOptimized: 575649
|