On 12/04/2016 11:39 AM, Martin Schreiber wrote: > On 12/04/2016 11:28 AM, Graeme Geldenhuys wrote: >> Hi, >> >> 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. >> > The problem with enlarging big dynamic arrays is that AFAIK there always > is a move operation of the whole existing data.
That happens with every reallocmem() with FPC memory manager so using a getmem() block instead of a dynamic array has no advantage in this regard. Dynamic arrays additionally call fillchar(). If fillchar() is not necessary for unmanaged items the MSEgui functions AllocUnInitedArray()/ReAllocUnInitedArray() can be used instead. Martin _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal