How does Objective-C selector lookup evolve from slow path to fast path?
Updated May 17, 2026
Short answer
Selector lookup starts with cache miss, falls back to method lists, and eventually resolves into cached IMP for fast execution.
Deep explanation
When objc_msgSend is invoked, runtime first checks the class cache (fast O(1) hash lookup). If missing, it searches method lists in the class and superclasses (slow O(n)). Once found, the selector-IMP mapping is stored in cache. Over time, frequently used methods become extremely fast due to cache locality. This is why hot paths in UIKit feel fast despite dynamic dispatch.
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