Use when optimizing Swift code performance, reducing memory usage, improving runtime efficiency, dealing with COW, ARC overhead, generics specialization, or collection optimization
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-swift-performance/SKILL.md -a claude-code --skill axiom-swift-performanceInstallation paths:
.claude/skills/axiom-swift-performance/# Swift Performance Optimization ## Purpose **Core Principle**: Optimize Swift code by understanding language-level performance characteristics—value semantics, ARC behavior, generic specialization, and memory layout—to write fast, efficient code without premature micro-optimization. **Swift Version**: Swift 6.2+ (for InlineArray, Span, `@concurrent`) **Xcode**: 16+ **Platforms**: iOS 18+, macOS 15+ **Related Skills**: - `axiom-performance-profiling` — Use Instruments to measure (do this first!) - `axiom-swiftui-performance` — SwiftUI-specific optimizations - `axiom-build-performance` — Compilation speed - `axiom-swift-concurrency` — Correctness-focused concurrency patterns ## When to Use This Skill ### ✅ Use this skill when - App profiling shows Swift code as the bottleneck (Time Profiler hotspots) - Excessive memory allocations or retain/release traffic - Implementing performance-critical algorithms or data structures - Writing framework or library code with performance requirements - Optimizing tight loops or frequently called methods - Dealing with large data structures or collections - Code review identifying performance anti-patterns ### ❌ Do NOT use this skill for - **First step optimization** — Use `axiom-performance-profiling` first to measure - **SwiftUI performance** — Use `axiom-swiftui-performance` skill instead - **Build time optimization** — Use `axiom-build-performance` skill instead - **Premature optimization** — Profile first, optimize later - **Readability trade-offs** — Don't sacrifice clarity for micro-optimizations ## Quick Decision Tree ``` Performance issue identified? │ ├─ Profiler shows excessive copying? │ └─ → Part 1: Noncopyable Types │ └─ → Part 2: Copy-on-Write │ ├─ Retain/release overhead in Time Profiler? │ └─ → Part 4: ARC Optimization │ ├─ Generic code in hot path? │ └─ → Part 5: Generics & Specialization │ ├─ Collection operations slow? │ └─ → Part 7: Collection Performance │ ├─ Async/await overhead visible? │ └─