| 02-03-2009, 08:36 PM | #1 |
Even if it is barely, I've always wanted to know what is faster: JASS:
set d = SquareRoot( ( x - .x ) * ( x - .x ) + ( y - .y ) * ( y - .y ) + ( z - .z ) * ( z - .z ) )
if d <= a + b then
or JASS:
set d = ( x - .x ) * ( x - .x ) + ( y - .y ) * ( y - .y ) + ( z - .z ) * ( z - .z )
if d <= ( a + b ) * ( a + b ) then
or JASS:
set d = ( x - .x ) * ( x - .x ) + ( y - .y ) * ( y - .y ) + ( z - .z ) * ( z - .z )
set r = a + b
if d <= r * r then
|
| 02-04-2009, 12:51 AM | #2 |
Probably example 3. |
| 02-04-2009, 01:04 AM | #3 |
I'd say the second example, assuming that the local variable r from the third example doesn't need to be allocated in the second one. Then again, you could use a global, but the speed difference is not significant enough to tolerate such uglyness. |
