Re: NSView -drawRect optimization
Re: NSView -drawRect optimization
- Subject: Re: NSView -drawRect optimization
- From: Paul Bruneau <email@hidden>
- Date: Wed, 13 Feb 2008 08:22:40 -0500
On Feb 12, 2008, at 5:31 PM, Peter Ammon wrote:
On Feb 12, 2008, at 2:02 PM, Paul Bruneau wrote:
My only concern with it is the frames per second draw speed of the
view (it's all done in -drawRect). I have done pretty good testing
to remove individual segments of code from the loop in order to
see what is taking the time:
Hi Paul,
It's not clear how you are measuring the fps, but a common cause of
slow drawing is that your app triggers immediate rendering too
often, which will be throttled by coalesced updates. See http://
developer.apple.com/technotes/tn2005/tn2133.html for more information.
To determine if you are being bitten by this, launch Quartz Debug
and turn on Disable Beam Synchronization under the Tools menu. If
your fps improves substantially, that's the culprit.
Thanks for your reply, Peter (and thanks to the others who replied).
I'm out of my office today but I will respond to some more tomorrow.
I am measuring fps by storing the time at the start of -drawRect and
then at the end of -drawRect I display 1/elapsedTime in the lower
left corner of the view (you can see it in my screenshot). It varies
a little as I scroll or move orderSteps but I get a good idea from it
I think.
I have read the technote you linked but I am not sure if it affects
me. I suspect not since all my drawing is in -drawRect and I never
explicitly call it myself but rely on the OS to call it for me. I
just call -setNeedsDisplay on the view when my program changes
something that requires the view to be redrawn. If I am way off-base,
please let me know.
I will disable beam synchro to see if it affects me. Thank you.
_______________________________________________
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