Code Optimisation: Difference between revisions
Jump to navigation
Jump to search
m (Formating and links) |
No edit summary |
||
Line 4: | Line 4: | ||
==Getting position== | ==Getting position== | ||
* [[getPosASL]]/[[getPosATL]] are 1.67x FASTER than regular [[getPos]] | * [[getPosASL]]/[[getPosATL]] are 1.67x FASTER than regular [[getPos]] | ||
==Loops== | |||
These first two loop types are identical in speed, being more than twice as fast the proceeding two loop types. | |||
"_y" from 0 to (count [0,0,0,0] - 1) step 1 do { ... }; | |||
{ ... } foreach [0,0,0,0]; | |||
_y=0; while {_y = _y + 1; _y < count [0,0,0,0]} do { ... }; | |||
for [{_y=0},{_y<(count [0,0,0,0])},{_y=_y+1}] do { ... } |
Revision as of 21:37, 20 January 2010
Adding elements to an array
- set is 56x faster than binary addition (_a set [count _a,_v] vs _a = _a + [_v])
Getting position
Loops
These first two loop types are identical in speed, being more than twice as fast the proceeding two loop types.
"_y" from 0 to (count [0,0,0,0] - 1) step 1 do { ... }; { ... } foreach [0,0,0,0];
_y=0; while {_y = _y + 1; _y < count [0,0,0,0]} do { ... }; for [{_y=0},{_y<(count [0,0,0,0])},{_y=_y+1}] do { ... }