Speeding up protocol conformances in Swift
summary
Profiling real App Store binaries shows protocol conformance checks are a top cost — a flame chart attributes 470 ms to Swift_conforms_to_protocol — because cache misses force a linear scan of every protocol conformance descriptor in the Swift5 proto section. A test with 50,000 conformances -> 71 ms on first run (then fast on hits) demonstrates N² behavior; Swift 5.4’s hash-table cache gives 13x faster hits, iOS 16’s dyld prebuilds a cache but not on first launch, and a drop‑in runtime shim zcconform replacement speeds CI and snapshot testing.
AI-written summary · about
chapters (15)
- 0:00Introduction to swift performance
- 3:15Profiling with flame charts
- 4:26Identifying slow conformance checks
- 5:46What are conformance checks
- 7:20Testing the conformance cache
- 9:18The impact of app complexity
- 11:18Compiler view of conformances
- 13:10Applications of conformance knowledge
- 15:23Why conformance checks are slow
- 18:30Mitigation strategies
- 20:36iOS 16 dyld optimizations
- 22:53Limitations of dyld cache
- 24:08Zconform solution
- 25:35Optimizing code for performance
- 27:30Future of swift performance
related talks
40mThe Impact of the Swift Runtime on App Performance
30mFrom Slow to Flow: Tips for Accelerating Your App Performance
33mScaling Swift Development
40mSlow Swift
36mSWIFT ABI Essentials: How to Maximize Your App's Efficiency
18mHigh-performance systems in Swift
01h 00mThe Mysterious Swift Performance
37mProfiling Swift Performance on Linux
