Does it make a difference in performance if I use self.fooBar instead of fooBar?

Posted by mystify on Stack Overflow See other posts from Stack Overflow or by mystify
Published on 2010-05-26T15:30:03Z Indexed on 2010/05/26 15:31 UTC
Read the original article Hit count: 237

Note: I know exactly what a property is. This question is about performance.

Using self.fooBar for READ access seems a waste of time for me. Unnecessary Objective-C messaging is going on. The getters typically simply pass along the ivar, so as long as it's pretty sure there will be no reasonable getter method written, I think it's perfectly fine to bypass this heavy guy.

Objective-C messaging is about 20 times slower than direct calls. So if there is some high-performance-high-frequency code with hundreds of properties in use, maybe it does help a lot to avoid unnessessary objective-c messaging?

Or am I wasting my time thinking about this?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c