Swift 2 Under the Hood
summary
Swift 2.1 compiles through an AST to SIL -> LLVM IR and uses whole-module optimizations and inlining to remove calls (example: a private add function disappears), producing fewer CPU instructions and fewer cache misses; value types lay out arrays contiguously so scanning ints hits cached 64-byte lines instead of dereferencing objc pointer arrays. objc_msgSend overhead is highlighted historically (hundreds to ~47 bytes), Apple accepts bitcode for App Store relinking, and a sill-inspector (GitHub) tool shows the pipeline.
AI-written summary · about
chapters (28)
- 0:00Introduction
- 0:16About This Talk
- 1:22Pre-history
- 5:14A lot has changed...
- 6:05CPU speed
- 8:11Memory latency
- 9:59Why Swift?
- 10:47Modules
- 11:57Types
- 12:47Numeric values
- 14:31Protocols
- 15:40Memory optimisation
- 17:57Static and Dynamic?
- 19:34Static Dispatch
- 20:25objc_msgSend
- 22:10Optimisations
- 23:16Whole Module Optimisation
- 24:46Swift and LLVM
- 25:34Swift compile pipeline
- 28:17Example C based IR
- 29:21Advantages of IR
- 29:56Example Swift based IR
- 32:54Swift Name Mangling
- 33:26Swift Intermediate Language
- 34:25Swift v Tables
- 35:38SIL Inspector
- 47:19Is Swift swift yet?
- 48:52Summary
related talks
49mState of Swift Internals: Swift 4 & 5
01h 00mThe Mysterious Swift Performance
36mSWIFT ABI Essentials: How to Maximize Your App's Efficiency
32mContributing to Open Source Swift
57mCatching up with Swift
24mCompilers and LLVM Demystified
47mAn Introduction to the Swift Programming Language
07mSIL for First Time Learners
