The Impact of the Swift Runtime on App Performance
summary
Explains the Swift Runtime function swift_conformsToProtocol: what it does, why it can be slow, and how to minimize its calls. Covers concrete slow cases (as?/as! casts, String(describing:), and type-generic-constraint generics), shows why String(describing:) is expensive and when to replace it, and presents techniques and examples (including a SnapKit fork) to avoid or optimize as?/as! and generic-constraint usage. Finishes with practical recommendations teams can apply to speed up iOS apps.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:10About Swift Runtime
- 2:59Swift Runtime internals
- 3:42Conform to method problem
- 5:50Conformance in binary
- 8:41Method invocation
- 12:32Cast types and features
- 15:28Generics problem
- 18:21Optimization results
- 21:52SwiftUI optimization
- 24:30Generic casts
- 26:40Code recommendations
- 29:10DI and protocol casts
- 30:34Resources and conclusion
- 30:59Q&A
related talks
32mSpeeding up protocol conformances in Swift
20mHow Not to Write Swift
47mAn Introduction to the Swift Programming Language
58mSwift: safety, ergonomics, productivity and legacy preservation
01h 00mThe Mysterious Swift Performance
36mSWIFT ABI Essentials: How to Maximize Your App's Efficiency
40mSlow Swift
28mUsability Meets Performance in Swift
