>> Now that Alex has the answer to his problem, can I ask a follow-up question >> based on this line in his initial email? >> >>> On 9 May 2021, at 1:12 am, Alex Zavatone via Cocoa-dev >>> <cocoa-dev@lists.apple.com> wrote: >>> _configurationDictionary = [[NSMutableDictionary >>> alloc]initWithDictionary:[NSDictionary >>> dictionaryWithContentsOfFile:filePath]]; >> >> What's the benefit of having the immutable NSDictionary in the mix there? >> _configurationDictionary = [[NSMutableDictionary alloc] >> initWithDictionary:[NSDictionary dictionaryWithContentsOfFile:filePath]] >> >> Is that somehow better than: >> _configurationDictionary = [[NSMutableDictionary alloc] >> initWithContentsOfFile:filePath] >> >> or even: >> _configurationDictionary = [NSMutableDictionary >> dictionaryWithContentsOfFile:filePath] >> >> Is any one more efficient than the other (I would've assumed the last one, >> with there being fewer objects and messages) but I suppose it's possible the >> compiler ends up optimising them all to be the same anyway? > > It does not. The ObjC compiler is not in a position to make such > optimisations. But worrying about optimisation on that level is pointless; > you’re about to hit the file system which is vastly slower than an extra > message send.
Heh, fair point! > Most likely the OP has just gone with what reads most conveniently to them... OK, thanks. So it's literally just personal preference then. I did wonder if that might be the case, but figured I'd ask the question. It reminds me of my perl days - TMTOWTDI Cheers Mark _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com