• 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
Re: ObjC in time-critical parts of the code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC in time-critical parts of the code


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

Hi Jeremy,

On Jan 16, 2009, at 04:52, Jeremy Pereira wrote:

On 15 Jan 2009, at 22:16, Jens Bauer wrote:

..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

I compiled your program into an Xcode project. I got an answer of 0.021ms.


I modified the project to call renderObject 1,000 times and I got the answer 0.028ms.

The only thing I can think of is that you have confused milliseconds and microseconds.

I believe that it depends on if the application is doing something else, rather than just an empty loop.
In my case, I have at least one extra thread running, sometimes more threads.
The project is running on a G5 DP/2.0GHz, and will not be used on intel machines, so many of you might get faster execution times than me.
-But the 'warning' isn't about the average value, it's about the peak value, which sometimes takes ages, and when doing a real-time app, it might be important to avoid such peak values.


I changed the NSLog to report microseconds instead of milliseconds, and to avoid sending a million of lines, I recorded the max peak values:

	if(renderTime > maxRender)
	{
		maxRender = renderTime;
		NSLog(@"time: %.03fus", renderTime);
	}

1/16/09 08:36:53 MyApplication[22784] time: 2552.000us
1/16/09 08:37:33 MyApplication[22784] time: 3467.000us
1/16/09 08:38:34 MyApplication[22784] time: 3705.000us
1/16/09 08:40:36 MyApplication[22784] time: 3872.000us
1/16/09 08:46:41 MyApplication[22784] time: 6753.000us
1/16/09 08:53:20 MyApplication[22784] time: 7985.000us

When I use only C-routines, I get no high peak values.


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: 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>)
 >ObjC in time-critical parts of the code (From: Jens Bauer <email@hidden>)
 >Re: ObjC in time-critical parts of the code (From: Jeremy Pereira <email@hidden>)

  • Prev by Date: Re: ObjC in time-critical parts of the code
  • Next by Date: Re: ObjC in time-critical parts of the code
  • Previous by thread: Re: ObjC in time-critical parts of the code
  • Next by thread: Re: ObjC in time-critical parts of the code
  • Index(es):
    • Date
    • Thread