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 pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Objective-C interview questions

View all →