Hi List,I'm having a strange problem with key observing performance, namely registering observers.
I have an array of objects which is bound to a collection view and its views register themselves as observers of the array objects' properties (1 object, 1 view). The objects' properties are being observed somewhere else as well. There are 17 properties that are observed like this:
[object addObserver:self forKeyPath:@"prop" options:NSKeyValueObservingOptionNew context:nil];
The time needed to register the observation depends on the number of objects in the array. It increases exponentially. A small portion of the Shark log is here:
0.0% 58.8% rubiTrack -[registerObservers]0.0% 58.8% Foundation - [NSObject(NSKeyValueObserverRegistration) addObserver:forKeyPath:options:context:] 0.0% 58.4% Foundation - [NSObject(NSKeyValueObserverRegistration) _addObserver:forProperty:options:context:] 0.0% 41.8% Foundation _NSKeyValueObservationInfoCreateByAdding 8.1% 40.1% Foundation -[NSKeyValueObservationInfo _initWithObservances:count:] 0.5% 29.8% CoreFoundation -[__NSPlaceholderArray initWithObjects:count:]
2.6% 29.1% CoreFoundation CFArrayCreate 14.3% 16.6% CoreFoundation CFRetainThese numbers come from a test case with 140 objects, when I double the object number, the test never finishes (at least not within 10 minutes).
It appears I'm running into a problem with the number of properties that are being observed. When I observe only one property, the above takes up only 0.8% of the CPU time.
Is there a problem with observing may properties of the same object if you have may objects of that kind that are being observed? If so, is there a workaround?
Thanks for any input! Regards Markus -- __________________________________________ Markus Spoettl
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]