ios - Best practice to process big plists? -


i'm using plist file contains app data. file quite big , i'm loading stuff arrays , dictionaries @ first launch , save them userdefaults don't have touch plist again. takes 10 secs (ip4) wonder if there faster (better) way process plist. checked whole startup instruments , going through hundreds of entries fastest part. takes long save these processed stuff nsuserdefaults.

you might benefit saving plist own file. way control reading/writing, don't have overhead associated nsuserdefaults, and, importantly, can ensure format. is, if reading/writing producing slow down, you'll have minimize plist file size. using plist format of nspropertylistbinaryformat_v1_0 that:

see:

+ (nsinteger) writepropertylist: (id) plist                         tostream: (nsoutputstream *) stream                           format: (nspropertylistformat)format                          options: (nspropertylistwriteoptions) opt                            error: (nserror **) error 

from apple's property list programming guide:

the first approach [using nsdictionary or nsarray writetofile] simpler—it requires 1 method invocation instead of two—but second approach [as above] has advantages. allows convert runtime property list binary format xml property list. when convert static representation of property list graph of objects, lets specify more flexibility whether objects mutable or immutable.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -