Re: NSMutableArray sorting
Re: NSMutableArray sorting
- Subject: Re: NSMutableArray sorting
- From: Robert Marini <email@hidden>
- Date: Mon, 22 Dec 2008 02:08:30 -0500
I've never seen it documented though perceived performance would
indicate this is indeed the case. I've rarely come across a case
where sort descriptors weren't "fast enough" (indeed, given how well
they work with bindings it is somewhat essential). In general, if
this route is too slow then you probably should consider what your
storage is like - for instance, pre-calculating some value and caching
in a way that is simple to compare, etc. The original poster in this
thread mentioned the requirement of using external data sources for
the sorting and while I understand that it sometimes is a necessity,
I'd strongly avoid doing something like executing a query against a
remote db for each item in a table view for reversing the order (I
imagine it's not that horrid an example but you get my point). A
better design would be for the external data to alert the object to be
sorted that it's changed so that it could re-calculate and cache.
Your UI should be responsive as possible. At a certain point, even
the fastest sorting techniques will become slow due to the size of
data and the ancillary tasks involved.
-rob.
On Dec 21, 2008, at 11:04 PM, Scott Ribe wrote:
Have you tried using NSSortDescriptor for sorting? It caches the
result of valueForKeyPath: internally, and is quite fast (as long as
you don't subclass it).
No. The documentation doesn't mention caching of values, and I had
no idea
it would do that.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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