开发者

iPhone Optimal Stack Data Storage

开发者 https://www.devze.com 2022-12-14 21:59 出处:网络
I have a set of data that I need accessible insdie my iPhone app. The data is constant and currently in a simple CSV format. One of the columns could easily be开发者_JAVA百科 used as a key in a dictio

I have a set of data that I need accessible insdie my iPhone app. The data is constant and currently in a simple CSV format. One of the columns could easily be开发者_JAVA百科 used as a key in a dictionary but what is the most efficient way to have this const data accessible inside the app? I'm thinking instantiating and populating a NSDictionary at launch is not optimal.


It depends on how much data you have and how complex it is. If you have a dozens or hundreds records, then the dictionary will work fine. If you have thousands, then you probably want to use core data. If your data model has a lot of internal complexity/business-logic, use core data.

Start with whatever is simpler for you to implement and only switch if it proves inefficient. If you use the model-controller-view design you can swap out your data model implementation without disturbing the rest of the app. In my case, I am familiar with core data so it saves me time to use it even in cases where it's probably overkill.

As an aside, I think people spend to much time worrying about efficiently processing alphanumeric information when the graphics processing requirements of even the simplest app dwarfs that required for most alphanumeric data. Unless you know you've got thousands of complex records to manage, I wouldn't spend anytime at all trying to optimize alphanumeric data handling in the early stages of the app. It's simply a waste of time.

0

精彩评论

暂无评论...
验证码 换一张
取 消