Qrof, it's easy enough to take out the bits you need.
Add
To the beginning of a program and put:
Within the main loop.
I tried it in Tracer's asteroid.bb demo under BlitzPlus and the results were far closer, although the CPU again beat the lookup tables on my machine. The difference was pretty negligable though. BlitzPlus in general appears to be slower at maths than Blitz3D.
Those large arrays ran fine on my copy of BlitzPlus by the way.
We're performing huge numbers of calculations here, and it's unlikely any real game is going to do that much, my intention here is only to prove that a real game is likely to perform far different to a program that calculates Sin and Cos only.
Thus why your time is best spent trying to find the real slow points in your code, and not worrying over 5ms of speed over a 300000 iteration loop. In smaller numbers of iterations, the millisecs difference actually reads as 0 on my machine, for both.
Running those code snippets alone on my machine puts CPU in front on Blitz3D at about twice as fast, and under BlitzPlus puts lookups in front by about 10ms. Blitz3D was twice as fast as BlitzPlus overall.
Add
;Lookup Table Dim Sin2#(36000000) Dim Cos2#(36000000) For a=0 To 35999999 Sin2#(a)=Sin(a) Cos2#(a)=Cos(a) Next ;Change this to switch test Const UseLookup=0
To the beginning of a program and put:
starmill = MilliSecs() If uselookup=0 Then For t = 1 To 300000 x1#=Sin#(Rnd(0,35999999)) x2#=Cos#(Rnd(0,35999999)) Next Else For t = 1 To 300000 x1#=Sin2#(Rnd(0,35999999)) x2#=Cos2#(Rnd(0,35999999)) Next End If result=MilliSecs() - starmill Text 0,0,result
Within the main loop.
I tried it in Tracer's asteroid.bb demo under BlitzPlus and the results were far closer, although the CPU again beat the lookup tables on my machine. The difference was pretty negligable though. BlitzPlus in general appears to be slower at maths than Blitz3D.
Those large arrays ran fine on my copy of BlitzPlus by the way.
We're performing huge numbers of calculations here, and it's unlikely any real game is going to do that much, my intention here is only to prove that a real game is likely to perform far different to a program that calculates Sin and Cos only.
Thus why your time is best spent trying to find the real slow points in your code, and not worrying over 5ms of speed over a 300000 iteration loop. In smaller numbers of iterations, the millisecs difference actually reads as 0 on my machine, for both.
Running those code snippets alone on my machine puts CPU in front on Blitz3D at about twice as fast, and under BlitzPlus puts lookups in front by about 10ms. Blitz3D was twice as fast as BlitzPlus overall.