NSPersistentStoreCoordinator
has four store types: NSSQLiteStoreType
, NSXMLStoreType
, NSBinaryStoreType
, and NSInMemoryStoreType
. I understand XML store can be handy for debugging, or In Memory when you need a volatile cache.
What are the real advantages of using the Binary Store type?
NSBinaryStoreType
will occupy the least disk space, and will load the fastest, of the atomic store types.
Atomic store types load every Core Data object in the document at once, so once the doc is loaded, it's all in memory and you never hit the disk again until you hit save:
. The NSSQLiteStoreType
will occupy binary-like disk space, will load extremely fast and can live in arbitrarily limited memory, but the document file needs to be available on disk as long as the app has it open -- it can't be deleted or overwritten by another app while you're using it, which the atomic types will tolerate. There are also some limitations of the SQL store type as laid out here -- in general atomic store types perform much faster and give you more features, at the expense of an ever increasing memory footprint.
NSBinaryStoreType
is by no means the most efficient atomic store type possible, it is not compressed in any way. You could write your own gzipped XML or JSON store type which would probably occupy the less disk space than either NSSQLiteStoreType
or NSBinaryStoreType
, at the expense of load/save speed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With