What performance penalties arise while using method swizzling in Objective-C?
Which, if any, compiler optimisations are defeated with message swizzling?
What performance penalties arise while using method swizzling in Objective-C?
Which, if any, compiler optimisations are defeated with message swizzling?
Swizzling makes the Objective-C runtime flush its method caches. If you do all your swizzling as early as possible in your program, this will probably have no noticeable impact.
The compiler can't do much to optimize method calls because Objective-C allows any method to be overridden, even at run time (as with swizzling). So you've already paid the performance price of swizzling whether you use it or not.