Re: NSMutableArray sorting
Re: NSMutableArray sorting
- Subject: Re: NSMutableArray sorting
- From: Ben Trumbull <email@hidden>
- Date: Mon, 22 Dec 2008 01:09:37 -0800
I've never seen it documented though perceived performance would
indicate this is indeed the case
Generally, implementation details about caching behaviors falls isn't
something that gets formally documented. It's not part of the API
contract, and can change some from release to release.
That said, Robert is right that NSSortDescriptor does significant
caching throughout the sorting. It assumes the results of valueForKey
are stable for the duration of the sorting operation. If your custom
comparison function is based on valueForKey, NSSortDescriptor will do
a much better job than -sortedArrayUsingFunction. That said,
NSSortDescriptor is really only happy with keys and keypaths, and
overriding its comparison method will disable the caching.
What kind of calculations are involved when sorting? I ask because .
5s for sorting 4000 objects seems *incredibly* slow
What Mike said.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden