Thread: GetNearest
View Single Post
Old 02-05-2010, 03:09 PM   #7
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Well, in this case, using multiplication requires you to declare additional locals or do the x - GetUnitX(u) calculation twice, so using Pow likely is faster. Otherwise, I believe I've seen other people post test results where Pow(x,2) was slightly slower than x*x while Pow(x,3) was slightly faster than its multiplication counterpart.

Either way, as your test shows, the difference is inconsequential in the context of this function.
__________________
Anitarf is offline   Reply With Quote