• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coalesced updates and refresh rate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coalesced updates and refresh rate


  • Subject: Re: Coalesced updates and refresh rate
  • From: Graham Cox <email@hidden>
  • Date: Wed, 15 Jun 2011 22:47:44 +1000

On 15/06/2011, at 10:30 PM, Wolfgang Kundrus wrote:

> We have to update a lot of small onscreen objects and performance is way better, when we travers them outside the Cocoa view tree. If we would use invalidating, we would have to go thru our complete view tree and check for overlaps with the update rect.
>

Does each object have its own view? If so, then that's definitely not a good idea. If not, then there really shouldn't be a problem  - checking for overlap with the update rect is a simple matter of a) invalidating the update rect(s) and b) at DRAW time, call [NSView needsToDrawRect:] to test for overlap. Invariably it is drawing that dominates performance for this type of scenario, so a simple YES/NO test of this type is well worthwhile and is very fast.

If you have, say < 1000 objects that need updating, a linear list of these will probably suffice on a modern machine. If you have more, a spatial hashing scheme such as BSP can give useful improvements, and NSView has the method -getRectsBeingDrawn:count: that can be used as an input to a spatial hash. I use this technique in DrawKit, and unless the objects are especially complex in what they draw, it's easy to achieve a refresh of many thousands of objects within 16mS (which equates to 60fps).

If you have found performance to be bad using Cocoa's drawing mechanism, I suggest you must have overlooked something or made a newbie error such as 1 view per object, because in my experience it is adequate in terms of scheduling the updates and testing for objects needing to be drawn. Cocoa caps the framerate at 60fps anyway so you will never do better than that, but it sounds like you're way off base, so there's a long way to go before giving up on the standard mechanism.

--Graham



_______________________________________________

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

  • Follow-Ups:
    • Re: Coalesced updates and refresh rate
      • From: Sean McBride <email@hidden>
    • Re: Coalesced updates and refresh rate
      • From: Wolfgang Kundrus <email@hidden>
References: 
 >Coalesced updates and refresh rate (From: Wolfgang Kundrus <email@hidden>)
 >Re: Coalesced updates and refresh rate (From: Graham Cox <email@hidden>)
 >Re: Coalesced updates and refresh rate (From: Wolfgang Kundrus <email@hidden>)
 >Re: Coalesced updates and refresh rate (From: Graham Cox <email@hidden>)
 >Re: Coalesced updates and refresh rate (From: Wolfgang Kundrus <email@hidden>)

  • Prev by Date: Re: Coalesced updates and refresh rate
  • Next by Date: Re: Coalesced updates and refresh rate
  • Previous by thread: Re: Coalesced updates and refresh rate
  • Next by thread: Re: Coalesced updates and refresh rate
  • Index(es):
    • Date
    • Thread