Image processing applications run quickly on a simulator, but on a real device (iPhone 4GS) very slowly .
When starting the application under the "tools" I see the following call tree:

Note that calls in the red circle are reported to require almost all the processor time of the method.
This method is a class method (not an instance method) with the following code:
@implementation Line2F + (CGFloat)signTested:(Point2F *)tested p1:(Point2F *)p1 p2:(Point2F *)p2 { return [Line2F signTestedX:tested.x testedY:tested.y p1x:p1.x p1y:p1.y p2x:p2.x p2y:p2.y]; } + (CGFloat)signTestedX:(CGFloat)testedX testedY:(CGFloat)testedY p1x:(CGFloat)p1x p1y:(CGFloat)p1y p2x:(CGFloat)p2x p2y:(CGFloat)p2y { return (testedX - p2x) * (p1y - p2y) - (p1x - p2x) * (testedY - p2y); } @end
Can someone explain why most of the processor time is spent on [NSObject release] and [NSObject retain] ?
memory-management profiling ios objective-c instruments
Guy
source share