3 ms·
> Then there is the fact that you basically make every insertion 3x as costly. You better have a good reason to need this given the additional complexity and ca
by nearbuy 5y ago
> Then there is the fact that you basically make every insertion 3x as costly. You better have a good reason to need this given the additional complexity and caveats.
This is the exact same average cost per element, just spread out evenly. Consider that each element still gets copied to the array of twice the size once whether you use this technique or the classic amortized version. Same average performance without the hitches (although copying a larger block of memory at once would likely be a bit faster).