• 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: KVO on objects in NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO on objects in NSArrayController


  • Subject: Re: KVO on objects in NSArrayController
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 03 Sep 2011 09:23:43 -0700

On Sat, Sep 3, 2011 at 12:12 AM, Trygve Inda <email@hidden> wrote:
> I understand that... I think the alternative would be to register an
> observer on all 8000+ objects in the array.

Yes, this is the expected pattern with KVO. Contrary to what you might
think at first, it is *fast*.

To use OmniPlan 2 as an example, each cell in each row in the outline
view registers itself as an observer of one property of the model
object (actually a controller-layer proxy). The row itself registers
as a KVO observer of a few other properties of that proxy. OmniPlan 2
documents usually have a few hundred if not thousands of rows.

We have never seen any of the KVO implementation functions appear in
our sample reports during performance testing.

In fact, KVO is *much* faster than using NSNotificationCenter for the
same purpose. But sending one NSNotification is much faster than
sending 8,000 KVO notifications.

So do what's right for the situation at hand. If you need to know
about the "marked" property of 8,000 objects, register yourself as a
KVO observer for each of those 8,000 objects.

--Kyle Sluder

>
> For now however, the checkbox is the only way to alter the marked state so
> this should work.
>
> Thanks!
>
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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: KVO on objects in NSArrayController
      • From: Sean McBride <email@hidden>
References: 
 >Re: KVO on objects in NSArrayController (From: Jerry Krinock <email@hidden>)
 >Re: KVO on objects in NSArrayController (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: KVO on objects in NSArrayController
  • Next by Date: Best Practices for Associating a File Extension With a File in XCode 4?
  • Previous by thread: Re: KVO on objects in NSArrayController
  • Next by thread: Re: KVO on objects in NSArrayController
  • Index(es):
    • Date
    • Thread