News for hackers. Stuff that matters.
Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by Dutchie2020 on Sunday May 30, 2021 @05:11PM (#27336831)
Can someone please ELI5 this for me? What is the significance of speeding up objc_msgSend for Objective C?
Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by mucholove on Sunday May 30, 2021 @06:04PM (#27337315)
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. :)
Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by NobodyNada on Sunday May 30, 2021 @07:30PM (#27338043)
> 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.

Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by mucholove on Sunday May 30, 2021 @07:56PM (#27338266)
There 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.

:)

Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by tinus_hn on Sunday May 30, 2021 @08:06PM (#27338343)
If you write a message send in Objective-C, like [object doSomething], behind the scenes the compiler translates this to a call to the objc_msgSend function in the Objective-C runtime library. This function looks up what code needs to run, taking into account inheritance and all the other dynamic features and runs it. So this function runs really often and is an important target for optimization.
Re:Apple’s A15 chip will ship with an objc_msgSend branch pr... by diebeforei485 on Sunday May 30, 2021 @05:42PM (#27337132)
It is a codepath that is used a lot, in system frameworks that many apps use. So, speeding it up can yield a systemwide performance improvement for all sorts of apps.