Hacker News new | ask | show | jobs
by dhosek 3 hours ago
Isn’t there a performance cost though with runtime binding of functions? (I’ve not looked too closely at Swift since the first couple of years when Objective C compatibility was essential, so maybe that’s less of a default than it was in the early days).
1 comments

Runtime binding only occurs for Objective-C interop.

Swift functions are bound at compile time when statically known. Dynamic dispatch is done through vtables for native Swift classes, and through witness tables for protocol existentials.