I have this code in one of my projects (part of a loop):
newPath = [tileMap updatePathFromNode:point1 toNode:point2];
int x,y;
x = [[newPath objectAtIndex:0] nodeX];
y = [[newPath objectAtIndex:0] nodeY];
currFiend.motionTarget = ccp(x*20,y*20);
I am now looking for areas around my entire project to optimize the code. What i'm curious is about whether changing the above code to the following will have any performance impact whatsoever? I'm aware that the change might be minimal, even negligible, what i want to know is if it really does make any difference to not init and assign x,y.
newPath = [tileMap updatePathFromNode:point1 toNode:point2];
currFiend.motionTarget = ccp([[newPath objectAtIndex:0] nodeX]*20,[[newPath objectAtIndex:0] nodeY]*20);
Would this make any difference whatsoever? Shave time off allocations? Save memory?
Its more difficult to read than the first snippet, however in these methods im after performance, not code readability.