On Sun, Dec 4, 2016 at 5:28 AM, Graeme Geldenhuys <
mailingli...@geldenhuys.co.uk> wrote:

> If I use an array to hold a list of say Integers. Is there any serious
> performance penalty for resizing (growing) the dynamic array as I add
> items. My point being, I don't know the number of elements I'll need
> beforehand.
>

Power of 2 increments then (less re-allocations, less memory
fragmentation).
You'll also need to store the actual size somewhere next to the dynamic
array, since you can no longer rely on length()

thanks,
Dmitry
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to