4 ms·
Pretty much every method call, unless it is optimized—will go through `objc_msgSend`. The runtime looks up the code for a particular object using `objc_msgSend.
by mucholove 5y ago
Pretty much every method call, unless it is optimized—will go through `objc_msgSend`. The runtime looks up the code for a particular object using `objc_msgSend.` The function signature varies depending on how many parameters the method has but it always has at least 2 arguments—the instantiated object and the method name. Objc calls this the selector. :)
- NobodyNada 5y ago> Pretty much every method call, unless it is optimized Do those get optimized now? As far as I know, objc_msgSend was never optimized out (as of a few years ago when I was doing iOS dev) because any method can be swizzled and replaced at runtime.
- mucholove 5y agoThere is some sort of devirtualization that might bypass it. When they announced, Twitter was going crazy about how it might kill ObjC dynamism. However, what I was to was that you can store the method in a variable, and call it directly, thus bypassing objcMsgSend. :)