Linked List Vs Array

BlitzMax Forums/BlitzMax Programming/Linked List Vs Array

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm not sure there's a significant difference, unless you have a huge number of objects.

objects=1000

Type TThing
	Field a
EndType

Local array:TThing[objects]
Local list:TList=New TList

For n=1 To objects
	thing:TThing=New TThing
	array[n-1]=thing
	list.addlast thing
Next

now = MilliSecs()
For thing=EachIn array
Next
elapsed = MilliSecs()-now
Print "Array Elapsed:"+elapsed

now = MilliSecs()
For thing=EachIn list
Next
elapsed = MilliSecs()-now
Print "List Elapsed:"+elapsed