axiom analyze swift performance

Engineering Community

Skill notes

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning. Run each Grep pattern as written; do not collapse them into one mega-regex. Run the Read verifications each section calls for. "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Exclude

Skip: *Tests.swift, *Previews.swift, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/* Also skip SwiftUI view files (files with struct.*: View) — use swiftui-performance-analyzer for those.

Step 3: Identify Performance-Sensitive Code

Read 2-3 key files (data processing, networking layer, model layer) to understand: What are the large value types? (structs with arrays, many properties) Where are the tight loops? (data processing, parsing, rendering) What's the actor boundary pattern? (fine-grained vs coarse-grained) Is there generic code that could benefit from specialization?

Output

Write a brief Performance Hotspot Map (8-10 lines) summarizing: Large value types identified (structs with >5 properties or containing collections) Hot path locations (tight loops, data processing, parsing) Actor boundary pattern (fine-grained calls vs batched) Generic/existential usage pattern

Phase 2: Detect Known Anti-Patterns

Run all 8 existing detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Engineering
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
94 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@CharlesWiltgen · MIT
Token usage
Heavy
Setup complexity
Guided setup
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Phase 1: Map Allocation Hotspots

Phase 1: Map Allocation Hotspots

02
Step 1: Identify Type Characteristics

Step 1: Identify Type Characteristics

03
Step 2: Identify Hot Paths

Step 2: Identify Hot Paths

04
Step 3: Identify Performance-Sensitive Code

Read 2-3 key files (data processing, networking layer, model layer) to understand: What are the large value types? (structs with arrays, many properties) Where are the tight loops? (data processing, parsing, rendering) What's the actor boundary pattern? (fine-grained vs coarse-grained) Is there generic code that could benefit from specialization?

05
Phase 2: Detect Known Anti-Patterns

Run all 8 existing detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

06
Phase 3: Reason About Context-Dependent Performance

Using the Performance Hotspot Map from Phase 1 and your domain knowledge, check for issues that depend on *where* the code runs — not just *what* the code does. Question · What it detects · Why it matters Are any of the Phase 2 patterns inside tight loops or data processing pipelines? · Anti-patterns amplified by iteration · An unnecessary copy in a one-shot function costs microseconds; the same copy in a loop processing 10K items costs milliseconds

07
Phase 4: Cross-Reference Findings

Bump severity for these combinations: Finding A · + Finding B · = Compound · Severity Large struct copy · Inside tight loop · N copies per iteration · CRITICAL Actor hop in loop · No batching alternative · 100μs × N per loop iteration · CRITICAL `any` protocol collection · Iterated in hot path · Witness table lookup per element per iteration · CRITICAL

08
Phase 5: Swift Performance Health Score

Scoring: OPTIMIZED: No CRITICAL issues, hot paths free of amplified anti-patterns, >80% appropriate ownership/ARC, no `any` in hot paths OVERHEAD: No CRITICAL issues in hot paths, but some unnecessary copies, missing reserveCapacity, or gratuitous ARC traffic BOTTLENECKED: Any CRITICAL issues in hot paths, or actor hops in tight loops, or large struct copies in iteration

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.