Consider this Objective-C code (ARC enabled):
[self.aProperty sendMessage]; if (self.aProperty) { [self doSomethingWithProperty:self.aProperty]; }
I am wondering if rewriting the code for the cut snapshot will be faster (in versions):
MyPropertyClass* myProperty = self.aProperty; [myProperty sendMessage]; if (myProperty) { [self doSomethingWithProperty:myProperty]; }
The question is, can Apple LLVM Compiler 3.0 optimize re-access to property recipients? Does any value matter if the property is non-atomic?
If I were to guess, I would say that writing the code below is faster, because the compiler has no guarantee that self.aProperty will not change during these lines. I'm right?
source share