When I fill in the encodeWithCoder:
for objective c classes for an iPhone app will it make make the archive file larger if I use long keys as opposed to short keys for all of my variables?
For example if I use really long keys like this:
[coder encodeBool:myBoolean forKey:@"My_Excesively_Long_Boolean_Key"];
will it make the archive file longer than if I use stuff like this:
开发者_JAVA百科[coder encodeBool:myBoolean forKey:@"Key01"];
Assuming I have a large number of ints and BOOLs.
Unless you have hundreds of thousands of keys, you won't see any noticeable size increase. On modern systems text is trivial. You could store tens of thousands of keys in a couple of megs.
The use of long highly unique keys, constants, class names, ivars etc is actively encourage because of Objective-C's open name space.
Larger the archive grows, longer is the time it takes to restore it into your data structure. The size of your archive is too small compared the the flash memory size available these days (in 2011)
精彩评论