I'm using a Vec<T>
in ink!
. When allocating elements to the vec, the underlying array may be resized to provide a constant amortised push complexity of O(1). This means that sometimes the vec has unused space (e.g. 5 items in the vec but the underlying array has length 8 with 3 null elements).
Does the vec get stored with or without the unused space in the smart contract?
I am currently considering calling shrink_to_fit()
before saving the vec in smart contract storage in order to save space. However, I'm hoping ink!
does this automatically.