| 02-12-2007, 06:48 PM | #1 |
Is generally passing X,Y coordinates more efficient than passing location? I suppose so because you have to destroy the created locations. |
| 02-12-2007, 07:07 PM | #2 |
passing locations is 'faster' but it is way slower if you have to create and destroy the location |
| 02-12-2007, 07:27 PM | #3 | |
Quote:
So for example : Code:
Function1 takes location l returns boolean ... endfunction Function2 takes real x, real y, returns boolean ... endfunction Function3 takes nothing returns nothing ... set unit_loc = GetUnitLoc(u) set unitX = GetUnitX(u) set unitY = GetUnitY(u) set a = Function1(unit_loc) set b = Function2(unitX, unitY) call RemoveLocation(unit_loc) set unit_loc = null ... endfunction Which is faster? |
| 02-12-2007, 08:06 PM | #4 |
I try to use more X, Y than locations, because you save the usage of one handle var. Since that point of view I think is faster and safer. |
| 02-13-2007, 12:39 AM | #5 |
I think that warcraft works faster with coordinates than with locations because location have more parameters than "x" and "y", as example: "SetUnitPositionLoc" is slover than "SetUnitX","SetUnitY", i think you know it. |
| 02-13-2007, 12:54 AM | #6 |
SetUnitX/SetUnitY requires passing four arguments and two native calls, as opposed to three arguments and one call so what's your point? |
| 02-13-2007, 01:32 AM | #7 |
Naes, natives that take locations are faster than the equivalent ones that take coordinates (As in unnoticeable faster). SetUnitX + SetUnitY are not really equivalent to SetUnitPosition, they are very different natives besides the similar names. ANd in this case SetUnitX/Y are much faster. And although location taking natives are "faster" than coordinate equivalents they require to at least remove the location most of the times thus becoming way slower. |
