Re: Optimizing View Drawing Code
Re: Optimizing View Drawing Code
- Subject: Re: Optimizing View Drawing Code
- From: Markus Spoettl <email@hidden>
- Date: Fri, 8 Jan 2010 17:50:00 +0100
On Jan 8, 2010, at 5:18 PM, Stephen Blinkhorn wrote:
> I can verify this by removing all drawing code from my drawRect: method but gaining almost no extra performance (CGLayers are fast :). Even with an empty drawRect: method if I comment out the setNeedsDisplay:YES line in the meter then the CPU drops to almost zero. I'm looking at 15-20% CPU on a dual core 2.3GHz machine - quite a lot really.
Are you absolutely sure that you're not updating more than the 20 times mentioned in your initial message? Something doesn't add up - that load should be handled easily. You may be calling it more often that you think. Also, how many views are you updating each time the timer expires? I can imagine that if you do that on a lot of views 20 times a second the system could go down like that.
Also, do you really have to update the entire view each time? What speeds up drawing a lot is specifying a dirty rect as small as possible and restricting the actual drawing to the area inside the rect whenever possible. May not be relevant in your case as the bottleneck seems to be somewhere else.
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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