Re: sort descriptor optimization
Re: sort descriptor optimization
- Subject: Re: sort descriptor optimization
- From: "Adam R. Maxwell" <email@hidden>
- Date: Tue, 4 Jul 2006 10:44:34 -0700
On Jul 2, 2006, at 16:53, Adam R. Maxwell wrote:
Hi all,
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:
2006-07-04 10:31:42.926 kvcTest[5846] BDSKTableSortDescriptor:
15.528615 seconds
2006-07-04 10:31:50.413 kvcTest[5846] NSSortDescriptor:
7.472493 seconds
2006-07-04 10:32:30.665 kvcTest[5846] FastTrivialSortDescriptor:
40.240286 seconds
2006-07-04 10:33:29.521 kvcTest[5846] TrivialSortDescriptor:
58.854701 seconds
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:
This email sent to email@hidden