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
|
|
|
|
// ----
|
2021-01-08 03:45:19 +00:00
|
|
|
// storageEmpty -> 1
|
2020-11-12 14:29:08 +00:00
|
|
|
// fill() ->
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas irOptimized: 520998
|
|
|
|
// gas legacy: 521773
|
|
|
|
// gas legacyOptimized: 517048
|
2021-01-08 03:45:19 +00:00
|
|
|
// storageEmpty -> 0
|
2020-11-12 14:29:08 +00:00
|
|
|
// halfClear() ->
|
2021-01-08 03:45:19 +00:00
|
|
|
// storageEmpty -> 0
|
2020-11-12 14:29:08 +00:00
|
|
|
// fullClear() ->
|
2021-01-08 03:45:19 +00:00
|
|
|
// storageEmpty -> 1
|