We have an application that uses a custom NSSortDescriptor subclass
to handle nil values and empty strings differently from default.
Essentially, it looks like this:
[...]
It looks like -[NSSortDescriptor compareObject:toObject:] does some
caching of key paths, or somehow bypasses valueForKeyPath:
altogether, but I can't figure out how to do this.
If anyone's interested in a test app to play with Shark, I've
posted it at <http://homepage.mac.com/amaxwell> as kvcTest.zip.
With our sort descriptor subclass, I'm seeing times in the ~50
second range on a 1.33 G4; with NSSortDescriptor, times are ~8
seconds.
Well, having received no advice on this matter, I ended up filing
rdar://problem/4612866 against valueForKeyPath: and rdar://problem/
4612871 against array sorting when using an NSSortDescriptor subclass.
I also updated the sample project I posted, and I'm seeing the
following times from it:
BDSKTableSortDescriptor is my best shot (to date) at optimizing our
sort descriptor subclass; NSSortDescriptor is Apple's implementation;
FastTrivialSortDescriptor uses my own implementation of
valueForKeyPath:, and TrivialSortDescriptor uses Foundation's
valueForKeyPath: (all use the same comparison selector and key path).
-- Adam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden