0

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.

Jamvert
  • 76
  • 5
  • This seems like worrying about something that isn't going to matter. – nall Oct 30 '09 at 23:25
  • This seems like you spent more time posting about something than it would have taken to just try it and see for yourself. – Azeem.Butt Oct 30 '09 at 23:28
  • Good point. Doing a little rough math I would be hard pressed to get a megabyte worth of string in the worst case scenario. – Jamvert Oct 30 '09 at 23:38
  • @NSD, I was going to try to later on but I haven't figured a way look at the files on an iPod touch to see. – Jamvert Oct 30 '09 at 23:41
  • Okay I figured out where the simulator stores files, so I will just test and see later tonight. – Jamvert Oct 30 '09 at 23:55

2 Answers2

1

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.

TechZen
  • 64,370
  • 15
  • 118
  • 145
0

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)

Mugunth
  • 14,461
  • 15
  • 66
  • 94