On 10 Sep 2012, at 11:40, Motti Shneor <su...@bezeqint.net> wrote:

> Thanks everyone. You are ALL right in your comments, and still my problem 
> persists.
> 
> In reality, I have at least 6 external "triggers" or state-changes that 
> determine (in a quite complicated way) whether or not I should observe that 
> attribute.
> 
> The (rather wise!) suggestion to start my key-path at self, and so avoid the 
> need to watch for representedObject changes could cure one of the 6. Still I 
> have the other 5...
> 
> My question is general. Supposedly I could NOT start observing once, and stop 
> it once. Reasons:
> 1. There are many instances of that NSViewController
> 2. This observation is quite frequent in time (could reach 100 times a second)
> 3. The code to filter-out unwanted value-changes is CPU intensive. 
> (Accounting for 5 orthogonal conditions, upon which I should actually do 
> something with the attribute change) 
> 
> So - I'd rather REMOVE the observation when I don't need it.

How much measurement have you done on this? In my experience, often the act of 
setting up or tearing down an observation is more time-consuming than leaving 
it running. Once the observation is in place, it's a fairly passive system.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to