Quote Originally Posted by jdarling
TList is great for quick fixes that require small amounts of data and (possibly) medium access speeds. To me a BSP, Trie, or DLL (Doubly Linked List) would be much better options. Heck, even a bucket list would be faster than a TList with that many elements.
Actually, theres nothing slow about TList as such, as long as you avoid using the getter functions the amount of time taken to extract an element is really low, and for just stepping through the list it could be faster then a Linked list due to the element pointers being better aligned in the cache.

Only benefints between a DLL and a TList is removal of elements, its O(N) in a TList and O(1) in a DDL. Insertion (not adding to the end) is possible faster in a linked list, however you have to cache the list nodes so you dont have to create them all the time.

BSP/QuadTree/Octree are a whole different deal, but it is on a much higher level then TList vs LL or DLL as its a broadphase culling strategy.

So to summary to loop over a list without any list overhead (as fast as using a array) do like this:

[pascal]
for Index:=0 to List.Count-1 do
begin
Item:= TItem( List.List^[Index] );
// do something with Item
end;
[/pascal]
Back to topic, 100 000 visible objects seems alot, how would you even be able to see them at once on the screen?

If you are targeting top of the line hardware you might be able to push those numbers with hardware instancing but it is still a lot.

Some more information on what you are trying to accomplish would make it easier to see what you are trying to do and give better tips!