• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ObjC in time-critical parts of the code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ObjC in time-critical parts of the code


  • Subject: ObjC in time-critical parts of the code
  • From: Jens Bauer <email@hidden>
  • Date: Thu, 15 Jan 2009 23:16:02 +0100

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ObjC in time-critical parts of the code
      • From: Jeremy Pereira <email@hidden>
    • Re: ObjC in time-critical parts of the code
      • From: Shawn Erickson <email@hidden>
    • Re: ObjC in time-critical parts of the code
      • From: Shawn Erickson <email@hidden>
    • Re: ObjC in time-critical parts of the code
      • From: Chris Hanson <email@hidden>
    • Re: ObjC in time-critical parts of the code
      • From: Michael Ash <email@hidden>
    • Re: ObjC in time-critical parts of the code
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Re: Filtering NSPopUpButtonCell when clicking on it (From: Keary Suska <email@hidden>)
 >Fwd: Filtering NSPopUpButtonCell when clicking on it (From: Kubernan <email@hidden>)

  • Prev by Date: Re: Encoding / Decoding CGPoint with NSCoder
  • Next by Date: Re: Encoding / Decoding CGPoint with NSCoder
  • Previous by thread: Fwd: Filtering NSPopUpButtonCell when clicking on it
  • Next by thread: Re: ObjC in time-critical parts of the code
  • Index(es):
    • Date
    • Thread