3 ms·
Using 1.25 creates more copies along the way than 2x.
by karmakaze 3y ago
Using 1.25 creates more copies along the way than 2x.
- Dylan16807 3y agoSure. It's a tradeoff to avoid wasting huge amounts of memory once the list gets huge. No matter what the growth factor, you want to set the capacity up front if you know it. But 2x and 1.25x are both reasonable.