There isn't much UI going on here. The representedObject is a CoreData managed 
object, updated frequently by remote server notifications. I'm observing a 
to-many relation somewhere down the attribute-path of the representedObject, 
trying to filter only those new/updated items of interest. 

Only very few of the changes actually cause UI updates in the viewController.

While observing those frequent changes, inspection of them in the model (which 
is constantly being updated), and filtering for the interesting ones is simply 
too CPU intensive. There are plenty of other parts of the program that need 
CPU. I'd like to avoid monitoring these changes when unnecessary. 

Again --- I already solved this, in a non-elegant way (BOOL ivar that records 
the observation-state). It would be nicer to do this in a general manner, and 
without a member. Preferably, rely on the internal KVO mechanism.

On 10 בספט 2012, at 14:23, James Montgomerie wrote:

> On 10 Sep 2012, at 11:40, Motti Shneor <su...@bezeqint.net> wrote:
>> 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) 
> 
> Does your view controller need to be aware of all these changes? 100s of 
> changes a second is faster than your display can operate so, if this code is 
> just to keep your UI up to date, there's potentially a lot of redundant work 
> going on.
> 
> Is it possible that you could, instead of observing, do something simpler 
> like poll for changes while whatever's causing them to happen is underway?  
> For example, could you use an NSTimer firing once every 30th or 15th of a 
> second, calling a method that updates the UI?  This would avoid the overhead 
> of processing all those 100s of changes per second in the view controller.
> 
> Jamie.
> 

Motti Shneor, Mac OS X Software Architect & Team Leader
Spectrum Reflections Ltd.




_______________________________________________

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