I'm wondering if I should save data in my app to a plist or using Core Data..
My app is just basically saving tweets from timeline and other users now. Which is less than a few hunderd kB (about 200 kb in my testing). What's the advantages of using core data?
just some advices that could help in your app design.
First of all would be nice to underline that CoreData is not really comparable with plist. What I mean is that CoreData is like a data model abstraction layer over your data storage that allow you to manage relationships and fetching rules between different data entities. Behind the CoreData layer, your data storage could be based on plist (osx only), sqlite database or binary object.
This is also important because help you to understand the scope of CoreData: if you need to keep logical relationship between different data entities or perform multiple queries over the same data or serialize/deserialize big data structures, CoreData provides the best and fastest solution to make it happen. If you just need to store a plain list of items that just need to be displayed, a bounce of plist file should be enough.
Another important decision point is the type of data you need to store: according to Apple, plist files are optimized for strings, numbers, dates and some binary data. This is what Apple says about plist:
Note that property lists should be used for data that consists primarily of strings and numbers. They are very inefficient when used with large blocks of binary data.
Many applications require a mechanism for storing information that will be needed at a later time. For situations where you need to store small amounts of persistent data — say less than a few hundred kilobytes — property lists offer a uniform and convenient means of organizing, storing, and accessing the data.
It means that if you need to store "heavy" stuff or complex objects and manage them (like search trough them), the caching system of the plist parser could be inefficient (mostly on iOS).
In my opinion, your idea to store around 200k of linear tweets (around 1000 tweets?) from a timeline will works fine with a plist based solution. Also consider that the plist parser is strongly accelerated with small data structure then you will have better performance and low memory usage (mostly during startup) because you don't need to initialize CoreData nor any other "code wrapper" around your data storage. Just a simple on-the-fly usage of NSDictionary
, NSArray
and so on.
Last but not least, the plist implementation is cheap enough to give you the possibility to move on CoreData in a next step.
What I mean is that sometimes it's not necessary to use a tank if you need to catch some flies :-)
Hope this helps. Ciao!