Re: How Can I Notify DrawRect Method?
Re: How Can I Notify DrawRect Method?
- Subject: Re: How Can I Notify DrawRect Method?
- From: "Michael Ash" <email@hidden>
- Date: Tue, 9 Dec 2008 17:54:42 -0500
On Tue, Dec 9, 2008 at 11:34 AM, I. Savant <email@hidden> wrote:
> Also, the custom view that draws the rectangle should probably
> maintain this property itself (such as -rectColor). It's probably
> trivial for your current application (which looks like a learning
> exercise) but has performance implications in a full-fledged app. This
> way, you can always use [self rectColor] instead of all the messaging
> overhead of asking preferences each time you draw.
I must object to this justification. It may well be better design to
do things this way, but doing it because it's supposedly faster is
pointless. There is no way that fetching a value from NSUserDefaults
(which is basically just an NSDictionary lookup) will be even vaguely
noticeable against the cost of throwing a few thousand pixels onto the
screen. Even if it were slower, contorting the code like this without
having profiled the code and demonstrated that this is in fact a
significant slowdown is bad practice.
Mike
_______________________________________________
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