little Benchmark

BlitzMax Forums/BlitzMax Programming/little Benchmark

just a little sidenote, I managed to drop the Java run time from 90 seconds to 9!!! seconds by clamping the values between -PI/4 and +PI/4. The same test ist BLitzMAx didn't result in any speed increase, stays at 10,6 seconds. Funny ey?? somebody from a Java forum tried values too and came up with a funny result, to keep the speed high, you have to keep away from x^10 for sin and cos. Didn't try this though but very interesting.

SuperStrict

Local Anzahl : Long,Iterationen : Long,EndTime : Long,StartTime : Long,i : Long
Local  DauerMsec: Double,x : Double,y : Double
Local jo1:Double = -1*Pi/4
Local jo2:Double = Pi/4

Anzahl  =  Long ( Input("Anzahl Clients: "))
Iterationen = ((Anzahl-1)*Anzahl/2)

Local  jo3:Double = 2*jo2/Iterationen;
Local j:Double=jo1; 

EndTime = MilliSecs()

For i = 0 To Iterationen
	y = Sin(j)
	x = Cos(j)
	x = x*y
	j=j+jo3;
Next
StartTime = MilliSecs()
Print "Anzahl: " + String(Anzahl)
Print "Iterationen: " + String(Iterationen)

DauerMsec = StartTime - EndTime

Print "Millisekunden: " + String.FromDouble(DauerMsec)
Print "Sekunden: " + String.FromDouble(DauerMsec/1000)