Given NSArray *tagsArray and NSMutableDictionary *cache not empty.
This:
for (Tag *tag in tagsArray) {
NSString *name = tag.name;
[cache setObject:tag forKey:name];
}
should not be slower than this:
for (Tag *tag in tagsArray) {
[cache setObject:tag forKey:tag.name];
}
?
the __strong var ‘name’ would not use an implicit retain/release by ARC ? The compiler will actually generate the second from the first ?
Yes, it IS the same for ARC, because there’s no other code that interacts with “name” variable in first example.
For future, try to understand that ARC modifies your code for better performance and optimization, and not vice versa.
Here’s the link with entire documentation for ARC – must know – http://clang.llvm.org/docs/AutomaticReferenceCounting.html