> The concept behind zconform is to eagerly load all possible protocol conformances and store them in a map keyed by the protocol’s address in memory.
if it works well in most scenarios, couldn't this just be implemented directly in the swift runtime at some point?The trade-off of zconform's approach is that dynamic linking is slowed down by needing to eagerly identify all protocol conformances whenever an image is loaded (including conformances which are never even cast). It does make the performance of dynamic casting more deterministic, but it would slow down (for example) app launch by eagerly pre-caching things which might never be queried.
I'd expect that the response from the Swift team would be to avoid dynamic casting in performance-critical code, rather than pessimize link-time.
[Edit, to clarify why the cache needs to be rebuilt when libraries are loaded]: Swift protocols have a feature called retroactive conformance, which allows apps and libraries to add protocol conformance to types they don't own. So, any library that gets loaded could add a protocol to a type. It's a really powerful feature, but has some unfortunate side-effects...
Is the goal to make it faster later? What can be done to get closer to that goal?