Core data file size
I'm looking into storing lots of number as Int16. Considering Core data because the rest of the models are implemented in Core data.
So I did a simple application. Core data with 1 entity and 1 attribute of Int16
type. Inserted 1 mill开发者_JS百科ion entries in SQLite storage type and the file size turns out to be 16.2MB. Actually if I change to Int64
, I would get the same file size. If writing simple binary C array, should be around 2MB.
So question is, why did Core data bother with so many different kind of number format if everything will be casted to NSNumber anyway? And is there any way to make Core data store the data as true Int16
? or short
in C terms?
Thanks.
Just because Core Data supports all those number formats doesn’t mean the underlying storage engine has to store them in a different way. If you tried using the binary store you’d probably get different file sizes.
For storing that many integers I would put them all in a NSData
object and store this in Core Data.
精彩评论