seniorObjective-C
Why is objc_msgSend implemented in assembly instead of C?
Updated May 17, 2026
Short answer
Assembly is used to eliminate function call overhead and control register usage precisely.
Deep explanation
objc_msgSend is hot path in Objective-C. It must preserve registers, avoid stack setup, and perform cache lookup extremely fast. Assembly allows skipping function prologues/epilogues and directly manipulating registers (x0-x7 on ARM64).
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro