An image processing applications runs fast on the simulator, but is really slow on a real device (iPhone 4GS).
When running the application under "instruments", I see the following call tree:
Note that the calls within the red circle are reported to take almost all of the CPU time of the method.
The method in question 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 anyone explain why is most of the CPU time is spent on [NSObject release]
and [NSObject retain]
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With