logoalt Hacker News

dhosekyesterday at 9:14 PM1 replyview on HN

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).


Replies

anextioyesterday at 9:29 PM

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.