Did a few little tests to find out which is faster, here are my results:
Creating a new TList: 0ms
Creating a new Array: 0ms
Fill the TList with 100,000 Objects: 14ms
Fill the Array with 100,000 Objects: 40393ms
Read the values back from the TList: 3ms
Read the values back from the Array: 0ms
Most of you probably already know this, but it seems creating/filling TLists are faster than arrays, but reading values back from Arrays are way faster. Excellent!
Run it!
Creating a new TList: 0ms
Creating a new Array: 0ms
Fill the TList with 100,000 Objects: 14ms
Fill the Array with 100,000 Objects: 40393ms
Read the values back from the TList: 3ms
Read the values back from the Array: 0ms
Most of you probably already know this, but it seems creating/filling TLists are faster than arrays, but reading values back from Arrays are way faster. Excellent!
' TList vs Array Global HelloDump:Int Type Test Field Hello:Int = 100 End Type Global m = MilliSecs() Global Array:Test[] Global List:TList = New TList Global T:Test = New Test Print MilliSecs() - m For i = 0 To 100000 List.AddLast(T) Next Global z = (MilliSecs() - m) Print z For h = 0 To 100000 Array = Array[..Len(Array)+1] Array[h] = T Next Global q = (MilliSecs() - z - m) Print q For a:Test = EachIn List HelloDump = a.Hello Next Global r = (MilliSecs() - z - m - q) Print r For y = 0 To 10000 HelloDump = Array[y].Hello Next Global b = (MilliSecs() - z - m - q - r) Print b
Run it!