Re: Timer in drawing loop performance problems
Re: Timer in drawing loop performance problems
- Subject: Re: Timer in drawing loop performance problems
- From: Shayne Wissler <email@hidden>
- Date: Sat, 15 Aug 2009 13:50:26 -0600
Evidently I wasn't clear. It's using ~15% of the CPU while not drawing
anything at all, but just from the timer going off and calling
setNeedsDisplay. I don't actually redisplay unless something changed.
Thanks for the tip on CVDisplayLink, I missed that.
Shayne Wissler
On Sat, Aug 15, 2009 at 2:14 AM, Jean-Daniel
Dupas<email@hidden> wrote:
> And if you enabled vsync (which is by default), your code will never draw
> faster than the refresh rate (usually 60 Hz). That's probably why you never
> use more than 15 % of the CPU.
>
> Le 15 août 2009 à 06:05, Roland King a écrit :
>
>> 1) again I think you'll get better answers on the OpenGL list than the
>> cocoa dev list - the guys on that list eat and breathe openGL and I've had
>> some fantastic help there.
>>
>> 2) Are you targetting OSX 10.3 for your code? That tech tip says use an
>> NSTimer only for 10.3 compatibility and CVDisplayLink for anything from 10.4
>> onwards. If you do have to use a timer have you read the caveat about
>> enabling vertical synchronization (however one does that) or "the
>> application will burn a lot of CPU time just firing off the timer, even
>> though the drawing loop hasn't even completed its last run."?
>>
>>
>> On Aug 15, 2009, at 11:21 AM, Shayne Wissler wrote:
>>
>>> Hello,
>>>
>>> Following the advice at
>>> http://developer.apple.com/qa/qa2004/qa1385.html, I attempted using a
>>> timer running at 1000Hz. However, on my iMac, this causes about a ~15%
>>> CPU hit. When I run Shark, it says it's spending a good deal of time
>>> in objc_msgSend, presumably in the call "[self setNeedsDisplay:YES]".
>>>
>>> Is all this normal/expected?
>>>
>>>
>>> Shayne Wissler
>>> _______________________________________________
>>>
>>> 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
>>
>> _______________________________________________
>>
>> 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
>>
>
>
_______________________________________________
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