[fpc-pascal] performance when resizing a dynamic array

Marco van de Voort marcov at stack.nl
Sun Dec 4 17:24:48 CET 2016

In our previous episode, Graeme Geldenhuys said:
> 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.

Yes, ordered insertion is always a pain at high counts. But under
50000-100000 don't worry too much.

See also this thread:

(search for my post with "One can make the TStringlist problem also very visible with the

I mostly use my generic version of the lightcontainer (which is basically an
array based map using multiple arrays instead of one), it is in the
benchmark above, also with int64/tdatetime etc as keys.

More information about the fpc-pascal mailing list