较长的密钥会使 NSKeyedArchiver 文件明显变长吗

发布于 2024-08-09 10:00:39 字数 340 浏览 6 评论 0原文

当我为 iPhone 应用程序的目标 c 类填写 encodeWithCoder: 时,如果我对所有变量使用长键而不是短键,是否会使存档文件更大?

例如,如果我使用像这样非常长的密钥:

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

它会使存档文件比我使用这样的东西更长:

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

假设我有大量的整数和布尔值。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恋你朝朝暮暮 2024-08-16 10:00:39

除非您有数十万个密钥,否则您不会看到任何明显的大小增加。在现代系统上,文本是微不足道的。您可以在几兆内存中存储数万个密钥。

由于 Objective-C 的开放命名空间,因此积极鼓励使用长的、高度唯一的键、常量、类名、ivars 等。

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.

向日葵 2024-08-16 10:00:39

存档越大,将其恢复到数据结构中所需的时间就越长。与目前可用的闪存大小(2011 年)相比,您的存档大小太小

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文