Which is Faster?

Blitz3D Forums/Blitz3D Programming/Which is Faster?

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.

Type blah 
Field value% 
Field value2$ 
End Type 

Dim value(10000) 
Dim stringarray$(10000) 

Print "array access" 
t=MilliSecs() 
For i=0 To 10000 
n=value(i) 
tt$=stringarray$(i) 
Next 
t=MilliSecs()-t 
Print t+" ms" 
Print "" 


; Creating the type 
Print "Creating type" 
For i=0 To 10000 
b.blah=New blah 
Next 

Print "type access" 
t=MilliSecs() 
For b.blah = Each blah 
n=b\value% 
tt$=b\value2$ 
Next 
t=MilliSecs()-t 
Print t+" ms" 
Print "" 

Print "Press Any Key" 
WaitKey 
End 


Why create two arrays with 10000 elements per element in the first dimension when you only need 1. That doesnt make for a very accurate test.