quick poll - precalc sin & cos or perform every frame ?

BlitzPlus Forums/BlitzPlus Programming/quick poll - precalc sin & cos or perform every frame ?

Do you want proof? Instead of just making a statement Epicboy why dont you prove it? I have. Run the code below that shows I am right and you are wrong (as usual).

The results on my Cel(2GHz) were as follows....

On the fly took 31 milliseconds
Pre-calced tables took 1 millisecond

But it doesn't really matter how much proof I provide does it Epicboy? You are always right about these things (like Flameduck is also).



[Code]
Graphics 640,480,32,2

;Lookup Table
Dim Sin2(360)
Dim Cos2(360)
For a=0 To 359
Sin2(a)=Sin(a)
Cos2(a)=Cos(a)
Next

Iterations=100 ; change

; Calc on the fly
Time1=MilliSecs()
For t=1 To Iterations
For a=0 To 359
dx = Cos(a)
dy = Sin(a)
Next
Next
Time2=MilliSecs()
TimeTaken1=Time2-Time1


; Now Calc using tables
Time1=MilliSecs()
For t=1 To Iterations
For a=0 To 359
dx = Cos2(a)
dy = Sin2(a)
Next
Next
Time2=MilliSecs()
TimeTaken2=Time2-Time1


Text 10,10,"REPORT"
Text 10,30,"Calc On the fly took "+Str(TimeTaken1)+" millisecs"
Text 10,45,"Look up tables took "+Str(TimeTaken2)+" millisecs"

Text 10,70,"Conclusion... Look up tables are much faster"
Text 10,85,"and Epicboy talks out of his arse (as usual)."

Flip
WaitKey()
End

[/Code]