Production-focused iOS concurrency & performance case studies.
This repository demonstrates real-world bugs, root-cause analysis, and measured fixes using modern Swift concurrency and Apple performance tools.
Topics covered:
- async/await vs GCD
- Actor isolation
- Cancellation & cooperative cancellation
- Thread safety patterns
- ARC & retain cycles
- Instruments (Time Profiler, Leaks, Allocations, Hangs, Signposts, TSAN)
Goal: show how to debug, measure, and fix concurrency issues the way you would in a production iOS codebase.
If you already know how to “make it work”, this repo is about making it:
- Correct under concurrency
- Observable and measurable
- Maintainable under change
- Safe under load
The Senior → Principal difference becomes clear in how you:
- reason about failure modes
- validate fixes with evidence (Instruments, TSAN)
- document trade-offs and rollout strategy
- Xcode 15+
- iOS 15+
Open the workspace:
SwiftConcurrencyAndPerformance.xcworkspace
Run:
DemoApp(UIKit + Storyboard)
Apps/ DemoApp/ Modules/ CoreLogging/ CoreBenchmarks/ Docs/ 01-async-await-vs-gcd.md 02-actor-isolation.md 03-cancellation.md 04-thread-safety.md 05-arc-retain-cycles.md 06-instruments-playbook.md
Each demo follows a production-style template:
What does the user / QA / monitoring observe? (e.g. UI freeze, random crash, stale results, battery drain)
Root cause explained with concurrency primitives and timing.
Concrete changes in code (actors, cancellation, isolation, queues/locks).
Benchmarks + Instruments screenshots / logs (TSAN / Signposts / Hangs).
Trade-offs, edge cases, rollout notes, monitoring signals.
- Race condition demo (TSAN + fixes)
- Actor vs serial queue benchmark
- Cancellation & cooperative cancellation
- ViewModel-style cancellation
- Memory leak case study (ARC + Tasks)
- UI freeze root-cause analysis (Hangs + signposts)
- 01 – async/await vs GCD
- 02 – Actor isolation
- 03 – Cancellation
- 04 – Thread safety
- 05 – ARC & retain cycles
- 06 – Instruments playbook
MIT