Array timing

BlitzMax Forums/BlitzMax Beginners Area/Array timing

What failing example? The one from my other post that was not printing the results?

Or my third example above?


Here's the code for the second example:

Max:
Local A:Int[10000]

StartTime = MilliSecs()

For Loop = 1 To 1000

	For Y = 0 To 99
		Y2 = Y*100
		For X = 0 To 99
			A[Y2 + X] = 10
		Next
	Next
Next

EndTime = MilliSecs()

Print "Totaltime = " + (EndTime-StartTime)


BP:
Dim A(10000)

StartTime = MilliSecs()

For Loop = 1 To 1000

	For Y = 0 To 99
		Y2 = Y*100
		For X = 0 To 99
			A(Y2 + X) = 10
		Next
	Next
Next

EndTime = MilliSecs()

Print "Totaltime = " + (EndTime-StartTime)

WaitKey()



And here's the code for the third example:

Max:
Local A:Int[100, 100]

StartTime = MilliSecs()

For Loop = 1 To 1000

	For Y = 0 To 99
		For X = 0 To 99
			A[Y,X] = 10
		Next
	Next
Next

EndTime = MilliSecs()

Print "Totaltime = " + (EndTime-StartTime)



BP:
Dim A(100,100)

StartTime = MilliSecs()

For Loop = 1 To 1000

	For Y = 0 To 99
		For X = 0 To 99
			A(Y, X) = 10
		Next
	Next
Next

EndTime = MilliSecs()

Print "Totaltime = " + (EndTime-StartTime)

WaitKey()



And this is the code which should show a crash message in Max when not in debug mode, but just exits, because I wrote outside the arrays by accident:

Local A:Int[10000]

StartTime = MilliSecs()

For Loop = 1 To 1000

	For Y = 1 To 100
		For X = 1 To 100
			A[Y*100 + X] = 10
		Next
	Next
Next

EndTime = MilliSecs()

Print "Totaltime = " + (StartTime-EndTime)

WaitKey()