Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 852 Bytes

Arrays - Gas Costs.md

File metadata and controls

19 lines (15 loc) · 852 Bytes

Gas Costs of push and pop: Increasing the length of a storage array by calling push() has constant gas costs because storage is zero-initialised, while decreasing the length by calling pop() has a cost that depends on the “size” of the element being removed.

If that element is an array, it can be very costly, because it includes explicitly clearing the removed elements similar to calling delete on them.


Slide Screenshot

062.jpg


Slide Deck

  • push() & pop()
  • Push -> Constant Cost
  • Pop -> Depends on Element Size
  • Pop Array Element -> Expensive -> Delete Element

References