简体   繁体   English

想要在iPad中存储大量数据

[英]want to store large amount of data in iPad

I am working on the app in which large amount of data (eg 30K dictionary in array) is received through web service.I am using JSON kit for parsing this large amount of data. 我正在使用通过Web服务接收大量数据(例如,数组中的30K词典)的应用程序。我正在使用JSON工具包来解析大量数据。 I am recieving this data in chunk of 10k every time. 我每次都会收到10k的数据。

So, what is the best way to store this large amount of data plist file or SQLite database?? 那么,存储大量数据plist文件或SQLite数据库的最佳方法是什么?

I'd use a sqlite database. 我会使用一个sqlite数据库。 This allows you to quickly read values without the need to store the whole list in memory. 这使您可以快速读取值,而无需将整个列表存储在内存中。 It's easy to add and remove entries. 添加和删​​除条目很容易。 Lookup will be fast if your table has the proper index(es). 如果您的表具有正确的索引,查找将很快。

A plist would require the whole list to be in memory. 一个plist将要求整个列表都在内存中。 30k entries would easily fit in memory if each entry is just a word. 如果每个条目只是一个单词,那么30k条目将很容易装入内存。 But if it's more data or you never need the whole list at once, you really don't want all of that in memory. 但是,如果有更多数据,或者您一次也不需要整个列表,那么您真的不希望所有这些都存储在内存中。

CoreData is probably serious overkill for just a list. 对于一个列表,CoreData可能是严重的矫kill过正。

SQLite is best option to store large amount of data in iOS programming, because when you use any other method for storing purpose, it will require memory at run-time along with processing power to retrieve desired piece of data. SQLite是在iOS编程中存储大量数据的最佳选择,因为当您使用任何其他方法存储数据时,它将在运行时需要内存以及处理能力以检索所需的数据。 using SQLite, you can run a query that will return specific piece if data easily. 使用SQLite,您可以运行一个查询,该查询将轻松返回特定的数据。 hopefully this will help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM