Re: NSDictionary allValues not mutable
Re: NSDictionary allValues not mutable
- Subject: Re: NSDictionary allValues not mutable
- From: Greg Guerin <email@hidden>
- Date: Mon, 18 Oct 2010 15:18:47 -0700
Trygve Inda wrote:
This is probably true since this is a very minor part of my app...
I simply
need an array to display in a table with the added functionality of
being
able to locate a record uniquely (each object in the array has a
unique ID
as one of it's properties).
I recommend doing the simplest thing that could possibly work, then
measuring performance of that before making any other changes, or
even thinking about changes. If simple array searching is fast
enough, then you've already wasted time by thinking about how to use
a dictionary, posting on the list, etc.
Furthermore, there are simple additions to linear search of an
ordered array that can greatly improve speed. For example, copy the
search-keys of every 100th element into another ordered array.
Search it first to decide where to start a linear search in the main
list, and it's guaranteed you won't have to scan more than 100 main
elements. This is effectively a type of tree structure for
searching, and it can be recursively applied. Even though it's
simple, I wouldn't bother coding it unless actual measurements
indicate a need for it.
-- GG
_______________________________________________
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