<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Dec 4, 2016 at 5:28 AM, Graeme Geldenhuys <span dir="ltr"><<a href="mailto:mailinglists@geldenhuys.co.uk" target="_blank">mailinglists@geldenhuys.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If I use an array to hold a list of say Integers. Is there any serious<br>
performance penalty for resizing (growing) the dynamic array as I add<br>
items. My point being, I don't know the number of elements I'll need<br>
beforehand.<br></blockquote><div> </div><div>Power of 2 increments then (less re-allocations, less memory fragmentation). </div><div>You'll also need to store the actual size somewhere next to the dynamic array, since you can no longer rely on length()</div><div><br></div><div>thanks,<br></div><div>Dmitry</div></div></div></div>