4 ms·
A parent comment says it's due to variable number of arguments. I thought it was about speed, heh.
by exikyut 9y ago
A parent comment says it's due to variable number of arguments.
I thought it was about speed, heh.
- saagarjha 9y agoTo be honest, it's probably both. The runtime gurus at Apple do a great job hand-optimizing objc_msgSend for each platform since it's such an important factor in the overall speed of an Objective-C program.
- favorited 9y agoIt's (if not mostly, these days) about speed, but it is also to retain the notion that Objective-C methods are just C functions with 2 extra parameters, `self` and `_cmd`. But yes – when objc_msgSend is invoked tens of thousands of times/second, you'll write it in ASM to get the performance boost anyway. When you're a compiler or runtime engineer working in a language with as few opportunities for static optimization as Objective-C, you bet your ass you'll squeeze every drop possible from message dispatch.