4 ms·
as i recall, `libobjc` is ~25% of app launch time. `objc_msgSend` is quite expensive when you're making hundreds of thousands to millions of calls per second.
by why_only_15 6y ago
as i recall, `libobjc` is ~25% of app launch time. `objc_msgSend` is quite expensive when you're making hundreds of thousands to millions of calls per second.
- pjmlp 6y agoAlthough Swift has the spotlight, Objective-C keeps being improved. "Advancements in the Objective-C runtime" https://developer.apple.com/videos/play/wwdc2020/10163/ https://developer.apple.com/videos/play/wwdc2020/10163/
- jcfields 6y agoSwift uses the Objective-C runtime.
- microtherion 6y agoSwift is tiptoeing between static and dynamic typing, preferring the former when feasible, but often needing some of the latter when dealing with the UI.
- pjmlp 6y agoSwift can uses the Objective-C runtime for interoperability with Objective-C code, just like .NET uses COM on Windows. They need to interoperate with the rest of the platform.
- AJRF 6y agoThe compiler does some very fancy stuff with objc_msgSend to make it fast, and the selectors are interned. https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.html https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.h...
- donarb 6y agoObjective-C had an IMP pointer, essentially a function pointer. If you needed to send a message to an object in a tight loop, you could extract the pointer before the loop and use it inside.
- saagarjha 6y agoI would guess that most of app startup time isn't going to objc_msgSend (although it is still probably slow as it hasn't warmed up yet) but rather to setting up the various data structures used by the runtime, applying initial swizzling and the associated cache invalidation that comes from that, and those pesky +loads that every analytics framework thinks it need to have ;)