Threaded vs Non Threaded

BlitzMax Forums/BlitzMax Programming/Threaded vs Non Threaded

Hi, when I run the code below I get threaded=980 and unthreaded=1350

Why would 1 thread be quicker?


Strict
	

Function do_some_loops:Object( i:Object )

	Local j:Int
	Local superCalcResult:Double

	For j=1 To (String(i)).toint:Int()
	
		superCalcResult = j*Cos(j)+Tan(j)*j/j
	Next
	
End Function



Delay(2000)



Local time:Int = MilliSecs()

Local Thread1:Int = CreateThread(do_some_loops, "10000000")

WaitThread:Object( Thread1 )

time=MilliSecs()-time

Print "Thread :"+time



time:Int = MilliSecs()

do_some_loops:Object("10000000")

time=MilliSecs()-time

Print "Unthread :"+time



WaitKey()
End