2 ms·
But isn't resizing from 0 to n pretty much the same as allocating a fresh one of size n? (Not talking about the typical "resizing for n inserts one-at-a-time"
by asveikau 7y ago
But isn't resizing from 0 to n pretty much the same as allocating a fresh one of size n? (Not talking about the typical "resizing for n inserts one-at-a-time" approach, just going from zero to something.)
I mean, you have conditionals in the insert instead of unconditional allocation at the start, so maybe a little worse for things like branch predictors, but ...
- Ididntdothis 7y agoYou have a point there. In sum you would probably get the same performance. The only difference would be that the first insert would be slower vs the constructor as it is now.