Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm creating a simple "find one of our locations" app for iOS 4, for which I have a list of >70 places, complete with addresses, business hours, etc. Is it better to put all of this data in one large plist or many small ones?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Core Data or sqlite would probably be best, but between the two options you mention, I'd favor one large plist over many small ones. Maintaining and tracking 70 files is probably much more error prone than one, and the loading code would be much easier with one also (you can load the whole file into a big NSArray or NSDictionary with only a couple lines of code).

share|improve this answer
add comment

Premature optimization is the root of all evil. Do whatever is simpler/easier (depends on what form the data is in now), and then see how it performs. Even 70 items probably wouldn't take up much memory (assuming it's all text and no images), and I wouldn't be shocked if a naïve linear search is fast enough when you're finding the closest location. And if it isn't fast enough, a binary search probably is. (In fact, if you stored all 70 in an array, then created two "index" arrays that are just the indexes of the first array sorted by latitude and longitude respectively, you would probably perform just as well as a full-blown SQLite database.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.