2019-09-13 22:54:51 +00:00
|
|
|
contract C {
|
|
|
|
uint[][] array2d;
|
|
|
|
|
|
|
|
function l() public returns (uint) {
|
|
|
|
return array2d.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ll(uint index) public returns (uint) {
|
|
|
|
return array2d[index].length;
|
|
|
|
}
|
|
|
|
|
|
|
|
function a(uint i, uint j) public returns (uint) {
|
|
|
|
return array2d[i][j];
|
|
|
|
}
|
|
|
|
|
|
|
|
function f(uint index, uint value) public {
|
|
|
|
uint[] storage pointer = array2d.push();
|
|
|
|
for (uint i = 0; i <= index; ++i)
|
|
|
|
pointer.push();
|
|
|
|
pointer[index] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
function lv(uint value) public {
|
|
|
|
array2d.push().push() = value;
|
|
|
|
}
|
|
|
|
}
|
2020-09-28 12:41:27 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2019-09-13 22:54:51 +00:00
|
|
|
// ----
|
|
|
|
// l() -> 0
|
|
|
|
// f(uint256,uint256): 42, 64 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 114151
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 108234
|
|
|
|
// gas legacyOptimized: 102245
|
2019-09-13 22:54:51 +00:00
|
|
|
// l() -> 1
|
|
|
|
// ll(uint256): 0 -> 43
|
|
|
|
// a(uint256,uint256): 0, 42 -> 64
|
|
|
|
// f(uint256,uint256): 84, 128 ->
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 119535
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 107780
|
|
|
|
// gas legacyOptimized: 96331
|
2019-09-13 22:54:51 +00:00
|
|
|
// l() -> 2
|
|
|
|
// ll(uint256): 1 -> 85
|
|
|
|
// a(uint256,uint256): 0, 42 -> 64
|
|
|
|
// a(uint256,uint256): 1, 84 -> 128
|
|
|
|
// lv(uint256): 512 ->
|
|
|
|
// a(uint256,uint256): 2, 0 -> 512
|