Re: Re[4]: [fpc-pascal] about dynamic array

2010-05-08 Thread Jonas Maebe
On 08 May 2010, at 16:42, Vinzent Höfler wrote: >> 1) >> TheArray: array of ItemArray; >> AnyItem: ItemOfArray; >> [...] >> for j:=0 to 1000 do begin >> SetLength(TheArray,j+1); >> TheArray[j]:=AnyItem; >> end; >> [...] > > About 1000 GetMem operations (and 1000 assignments which aren't ther

Re: Re[4]: [fpc-pascal] about dynamic array

2010-05-08 Thread Vinzent Höfler
> 1) > TheArray: array of ItemArray; > AnyItem: ItemOfArray; > [...] > for j:=0 to 1000 do begin >SetLength(TheArray,j+1); >TheArray[j]:=AnyItem; > end; > [...] About 1000 GetMem operations (and 1000 assignments which aren't there in the code below, so I won't count them). > Now h

Re[4]: [fpc-pascal] about dynamic array

2010-05-08 Thread José Mejuto
Hello FPC-Pascal, Saturday, May 8, 2010, 1:26:09 PM, you wrote: >> But it is faster than inserting elements in a dynamic array (unless >> reference counted ones) because it usually moves less amount of data >> (4/8 bytes per element). VH> Implementing a dynamic array via a list implementation whi