from Hacker News

The Surprising Cost of Protocol Conformances in Swift

by sond813 on 12/2/21, 5:31 PM with 12 comments

  • by earthboundkid on 12/4/21, 5:46 AM

    I feels like I must be missing something. 3ms is extremely slow. Surely it should be 3us, no? What’s it doing that is so slow?
  • by andrekandre on 12/4/21, 12:39 AM

      > 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?
  • by olliej on 12/4/21, 5:37 AM

    This is about the casting cost specifically, not the direct cost of using a protocol as interface, which itself has some annoying performance characteristics
  • by syspec on 12/4/21, 7:26 AM

    Swift has a real performance problem, it doesn't seem competitive with other "systems languages"

    Is the goal to make it faster later? What can be done to get closer to that goal?