Re:Brad Cox has died
by saagarjha on Friday January 22, 2021 @11:12PM
(#25879568)
Objective-C, at least these days, is plenty fast, with a the cost of a message send being comparable to a virtual function call. The fast path of objc_msgSend is just over a dozen instructions.
[ Parent
| on HN ]
Plus for critical sections you can obtain method pointers which are just C functions.
Re:Brad Cox has died
by bitexploder on Saturday January 23, 2021 @05:46AM
(#25881323)
The M1 chip has specialized paths on it just to make the message sending even faster. That’s part of the M1 magic.
To be fair I think the extent of this specialization is a branch hint
Re:Brad Cox has died
by bitexploder on Saturday January 23, 2021 @07:45PM
(#25887643)
It’s still a kind of neat trick. One of those paths where even a little optimization goes a long way due to it being so hot.
Re:Brad Cox has died
by why_only_15 on Saturday January 23, 2021 @01:26AM
(#25880155)
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.
Although Swift has the spotlight, Objective-C keeps being improved.
"Advancements in the Objective-C runtime"
Swift uses the Objective-C runtime.
Swift 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.
Re:Brad Cox has died
by microtherion on Saturday January 23, 2021 @10:42AM
(#25882994)
Swift is tiptoeing between static and dynamic typing, preferring the former when feasible, but often needing some of the latter when dealing with the UI.
I 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 ;)
The 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.h...