开发者

NSDictionary lookup table with 200k entries - iPhone

I have a simple lookup table, which consists of the following structure:

int | string

  • given an int, I want to return a string. However I have to use a lookup table as there is no correlation between the int and the string.

What is the most efficient and fastest way to implement this on the iPhone in Objective-C?

E.g.

// However will 200k values take too long to load and take up too much memory? NSString *value = [lookupTable objectForKey:[NSNumber numberWithInt:key]]开发者_开发知识库


Without knowing how large your strings are, you should almost certainly be looking at coredata for this sort of thing. It'll work a treat for those sort of numbers and will keep your memory footprint low.

There's quite a nice coredata tutorial here and of course copious Apple documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜