Here is a very and straight forward question: How long will it take to search an array of 200-300 strings locally? What about remotely?
Search? In what sense?
If you are simply running:
[myStringArray containsObject:searchString];
then 200-300 strings can be searched in a few microseconds.
If you are searching:
BOOL found = NO
for (NSString *string in myStringArray)
{
if ([string rangeOfString:searchString].location != NSNotFound)
{
found = YES;
break;
}
}
Then it is almost entirely dependent on the length of each string but for strings less than a few dozen chars it is about the same as the previous search speed.
Remote searching is completely different -- but is a colossal waste of time for an operation like this. It is entirely based on network latency. Figuring on an average 250ms ping, an average time for a remote operation is about half a second or more just because it takes that long to generate the network packets, send over the net, wait for the remote server to receive, wait for the remote server to process, wait for the response and parse the response.
If this question was a round-about way of asking: should I just fetch all 30 strings and search locally -- then: yes, search locally. Generally: local searching is faster until the time taken to download all the results becomes a burden (over 3G, I normally consider 50kB about the maximum for fast transparent downloads).
If you are searching alphabetic strings, and the search time is prohibitive, you might try converting the string list to a DAWG (directed acyclic word graph, easy to google). I did this for a very long list (some 170,000 words) and got a improvement ratio of 18,000.
jrdoner
This is regarding local string searches.
I've implemented the Trie data structure to index strings for fast autocompletion. http://en.wikipedia.org/wiki/Trie