Re: NSView drawing optimization question
Re: NSView drawing optimization question
- Subject: Re: NSView drawing optimization question
- From: "Shawn Erickson" <email@hidden>
- Date: Mon, 9 Jul 2007 11:11:26 -0700
On 7/9/07, Matt Neuburg <email@hidden> wrote:
My question is: which is more "optimal"? Assuming this is happening 30 times
a second, is it "better" to redraw a single rectangle, which is sometimes
fairly small but might sometimes be nearly as large as the entire view, or
to redraw 18 small rectangles? (You can infer from the scare-quotes that I'm
not even sure what the goal should be.)
I think the only way to answer this will be to profile the code in
question under normal conditions and a few expected edge cases. At
some point the over head of drawing a large rect is going to dwarf the
overhead of individual smaller rects and vice versa.
Do keep in mind that using small rects and sticking to those (what you
get from getRectsBeingDrawn) could allow you to disable automatic
clipping which could improve performance, etc. Additionally the window
server can track this information even to the point of passing it on
via screen update callbacks (think screen casting software).
You could decide on a cut off point that toggles between two drawing
modes (the large rect is some % of the total view, etc.).
Likely the individual rect is the better path to take unless you find
performance issues (consider UI scaling in the future will result in
more pixels needing to be pushed around).
-Shawn
_______________________________________________
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