Often, especially when coding, there is more than one way to "skin a cat' (poor kitties). Different functions work at different speeds. Math functions are a good example. Use a speed testing program to test functions you want to use in your code. This will help tell you which ones are fastest.
Here's a sample speed tester code that checks the speed of addition, multiplication, and exponents (squaring). Interstingly enough, i*i is much faster than i^2!
` Test 1
t1=Timer()
For i = 1 to 100000
x=x+1
Next i
t1=Timer()-t1
` Test 2
t2=Timer()
For i = 1 to 100000
x=i*i
Next i
t2=Timer()-t2
` Test 3
t3=Timer()
For i = 1 to 100000
x=i^2
Next i
t3=Timer()-t3
` Print results
Print t1
Print t2
Print t3
wait Key
Recommendations:
1) When results are close, either consider them to be basically the same, or test several times in different orders.
2) You can use this to calculate if what you want to do will fit into your target FPS (Example: if you want 60 FPS, then Divide 1000 by 60). This will tell you how many miliseconds in between frame updates you have to play with. Remember though, some of the time is used up by drawing your graphics (which can also be calculated).
Example: ompc (on my pc, which is slow), I show it can do 100,000 multiplication calcs in 4 miliseconds. If I want a target FPS of 60, I take 1000/60 = 16.6. So, I'm using up almost 1/4th of my alotted miliseconds between each update for 100k calcs.
If I use i^2, I get 35 miliseconds to calc 100k times. This means I am using more than double the alotted 16.6 miliseconds between updates. I would probably end up with less than 25 FPS even though I want 60!
"Droids don't rip your arms off when they lose." -H. Solo
REALITY II