romaonthego romaonthego - 8 months ago 42
iOS Question

performSelector vs direct call performace

Is there any significant difference in performance when you call

[someObject performSelector:@selector(testMethod:) withObject:anotherObject];


[someObject testMethod:anotherObject];




The first causes an extra call to objc_msgSend() that isn't necessary in the second case.

The performance difference is unlikely to remotely matter unless you are calling said method as quickly as you possibly can many 10s of thousands of times and you aren't doing any significant work in testMethod:.

I.e. don't worry about it unless you measure an actual performance problem.