Rather than cobble together your own measurement infrastructure using old Carbon calls and NSLog, I recommend in the strongest possible terms that you measure your application's performance using purpose- built profiling and analysis tools like Shark and Instruments.

Performance measurement may seem simple at first glance but it can be very subtly hard to get right. That's why tools for it are supplied with Xcode, and why they need explicit support from the operating system.

  -- Chris

On Jan 15, 2009, at 2:16 PM, Jens Bauer <jensba...@christian.net> wrote:

Hi all,

I just want to let you know that I discovered I did a terrible mistake today. In other words: you don't have to learn from your own mistakes, if you can learn from mine. =)

I investigated this, because my rendering was choppy.

The code...

- (void)renderObject
{
}

- (void)renderAll
{
   UnsignedWide    us;
   double            time;

   Microseconds(&us);
   time = ((double) us.hi) * 65536.0 * 65536.0 + ((double) us.lo);
   [self renderObject];

   Microseconds(&us);
time = ((double) us.hi) * 65536.0 * 65536.0 + ((double) us.lo) - time;

   NSLog(@"time:%.3fms", time * 0.001);
}

..often used around 3ms for the empty method "-renderObject".
It gave me the terrible result of up to 21ms spent in the empty method!


-So I'd like to let you know that it's sometimes good to think "do I really need this method?" I will be rewriting around 8 of my large files for doing some rendering, so they will be using C-routines instead of ObjC methods, since I'm using them in a real-time environment.

My guess is that the message dispatcher probably needs to do something else than servicing *my* application, so I believe it's the nature of the environment, not a bug.


Love,
Jens

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cmh%40me.com

This email sent to c...@me.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to