Question

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:

[coder encodeBool:myBoolean forKey:@"Key01"];

Assuming I have a large number of ints and BOOLs.

Was it helpful?

Solution

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.

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top