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 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 3041780
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 3071205
|
|
|
|
// gas legacyOptimized: 3011873
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 5 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 368208
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 369241
|
|
|
|
// gas legacyOptimized: 366149
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 10 ->
|
|
|
|
// test_indices(uint256): 15 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 73803
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 0xFF ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 3455818
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 3514167
|
|
|
|
// gas legacyOptimized: 3398107
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1000 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 18383600
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 18617999
|
|
|
|
// gas legacyOptimized: 18178944
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 129 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 2742698
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 2772735
|
|
|
|
// gas legacyOptimized: 2716547
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 128 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 434013
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 467272
|
|
|
|
// gas legacyOptimized: 418424
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 363418
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 363407
|
|
|
|
// gas legacyOptimized: 361811
|