Objective-C swizzling performance method

What performance penalties occur when using the swizzling method in Objective-C?

What compiler optimizers, if any, are overcome with a message error?

+7
performance objective-c clang llvm method-swizzling
source share
1 answer

Swizzling forces the Objective-C environment to clear its caches of its methods. If you do all your swizzling as early as possible in your program, it probably won't have a noticeable effect.

The compiler cannot do much to optimize method calls, because Objective-C allows you to override any method even at runtime (for example, when swizzling). Thus, you have already paid for performance, depending on whether you use it or not.

+3
source share

All Articles