2020-11-12 14:29:08 +00:00
|
|
|
contract c {
|
|
|
|
uint[20] spacer;
|
|
|
|
uint[] dynamic;
|
|
|
|
function fill() public {
|
|
|
|
for (uint i = 0; i < 21; ++i)
|
|
|
|
dynamic.push(i + 1);
|
|
|
|
}
|
|
|
|
function halfClear() public {
|
|
|
|
while (dynamic.length > 5)
|
|
|
|
dynamic.pop();
|
|
|
|
}
|
|
|
|
function fullClear() public { delete dynamic; }
|
|
|
|
}
|
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
|
|
|
// ----
|
|
|
|
// storage: empty
|
|
|
|
// fill() ->
|
2021-04-08 12:57:18 +00:00
|
|
|
// gas irOptimized: 535914
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 504373
|
|
|
|
// gas legacyOptimized: 499648
|
2020-11-12 14:29:08 +00:00
|
|
|
// storage: nonempty
|
|
|
|
// halfClear() ->
|
|
|
|
// storage: nonempty
|
|
|
|
// fullClear() ->
|
|
|
|
// storage: empty
|