On Jul 26, 2009, at 2:38 PM, I. Savant wrote:
On Jul 26, 2009, at 3:52 PM, Aaron Burghardt wrote:Not necessarily. If the keys are NSStrings, then they are copied when added to the dictionary, but a copy of an immutable string is optimized to just retain it, so the data isn't duplicated (assuming all rows have the same columns in the same order, an assumption you don't seem to be making).Actually, I temporarily take back my "you're probably right" response. :-) I can't find a reference to this anywhere, but I admittedly only looked in the NSString API reference, the Introduction to Strings Programming Guide for Core Foundation and quickly perused the The Objective-C 2.0 Programming Language.Would you mind directing me to where this is stated? I'm not saying you're wrong - it sounds plausible - I'm just not sure you're right. :-)
"CFString objects perform other “tricks” to conserve memory, such as incrementing the reference count when a CFString is copied."
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFStrings/Articles/StringStorage.html#//apple_ref/doc/uid/20001179
It's not unreasonable, and we don't know the OP's performance requirements.No, it's not unreasonable, but since we don't know the OP's performance requirements, the original blanket statement that NSDictionary is better won't do without these caveats (ie, "it's easier for bindings, but dog-slow on reasonably large files"). Rather than just say "there's more to it than that" as a drive-by correction, I wanted to provide a helpful explanation and workaround, since this is an area in which I have recent and detailed experience. :-)
"Reasonably large files" is reasonably vague :). We have an application that keeps an array of bibliographic references, where each is an NSMutableDictionary with other properties. The largest file I recall throwing at it is ~20K items, and the main problem at that point was a beachball when using SearchKit...which was a nuisance to work around. It doesn't use bindings, but there really aren't any lazy loading tricks either.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
