1

在我实际测试它之前,我想知道这一点。

我有一个包含 210 个字典的 plist,在我的代码中,我NSArray通过该 plist 的内容来初始化一个。

在所有这些字典中,我需要枚举它们并检查一些东西:

for (NSDictionary *dict in largePlistArray) {

if ([[dict objectForKey: @"country"] isEqualToString: @"Cambodia"]) {

 NSLog (@"Random example!");

   }

 }

假设带有“Cambodia”的字典是整个数组中的最后一个,枚举完整的 200 多个字典对象数组需要多长时间?

谢谢!

4

1 回答 1

2

The best way to tell is to try it out. However, 200 does not strike me as a particularly large or even as a marginally large number. Consider this: 1GHz CPU runs a billion elementary operations per second. Even if each lookup takes 100 elementary operations (in reality, it takes much fewer than that) a search of 200 items should complete in very short time, on the order of milliseconds.

于 2012-10-20T01:47:02.170 回答