Is the gas usage constant for this function regardless of mapping/array size (assuming non-zero array entries)?
items
is an array, and presence
is a mapping
function clear() public {
for (uint i = 0; i < items.length; i++) {
presence[items[i]] = 0;
}
delete items;
}
In other words, is the gas refund from deleting the data greater than the gas consumed when iterating and querying the data?
This function is a snippet from this Set implementation.