Kyley Harris wrote:
This is why you are better off using object such as TCollection and TCollection item. there is no delete from the middle. shift all the memory down and setlength minus one 
It all depends on your access pattern. For simple groups of  simple types, or records that you create, pass around a few places, and then discard, a dynamic array is much cheaper - one call to allocate/deallocate lots of entries - rather than lots of individual calls to New and Dispose and/or Create. They're also reference counted for you (copy on write) and Delphi takes care of all the memory management.
 
If order within the array is important and insertion/deletion in the middle is common (so you can't move a single entry and chop), their performance is O(N) so you're better of with a linked list or similar indirect collection which has OO(log N) or O(1) insert/delete behaviour.
 
TTFN,
  Paul.
 
 
 
 
 
 

Reply via email to