axiom-ios-performance

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

iOS Performance Router

iOS 性能问题诊断路由

You MUST use this skill for ANY performance issue including memory leaks, slow execution, battery drain, or profiling.
任何性能问题(包括内存泄漏、执行缓慢、电池耗电快或性能分析)都必须使用此技能。

When to Use

使用场景

Use this router when:
  • App feels slow or laggy
  • Memory usage grows over time
  • Battery drains quickly
  • Device gets hot during use
  • High energy usage in Battery Settings
  • Diagnosing performance with Instruments
  • Memory leaks or retain cycles
  • App crashes with memory warnings
出现以下情况时使用此路由:
  • 应用运行缓慢或卡顿
  • 内存占用随时间增加
  • 电池耗电过快
  • 使用过程中设备发热
  • 电池设置中显示高能耗
  • 使用Instruments诊断性能问题
  • 内存泄漏或保留循环
  • 应用因内存警告崩溃

Routing Logic

路由逻辑

Memory Issues

内存问题

Memory leaks (Swift)
/skill axiom-memory-debugging
  • Systematic leak diagnosis
  • 5 common leak patterns
  • Instruments workflows
  • deinit not called
Memory leaks (Objective-C blocks)
/skill axiom-objc-block-retain-cycles
  • Block retain cycles
  • Weak-strong pattern
  • Network callback leaks
内存泄漏(Swift)
/skill axiom-memory-debugging
  • 系统化泄漏诊断
  • 5种常见泄漏模式
  • Instruments工作流
  • deinit方法未调用
内存泄漏(Objective-C blocks)
/skill axiom-objc-block-retain-cycles
  • Block保留循环
  • Weak-strong模式
  • 网络回调泄漏

Performance Profiling

性能分析

Performance profiling (GUI)
/skill axiom-performance-profiling
  • Time Profiler (CPU)
  • Allocations (memory growth)
  • Core Data profiling (N+1 queries)
  • Decision trees for tool selection
Automated profiling (CLI)
/skill axiom-xctrace-ref
  • Headless xctrace profiling
  • CI/CD integration patterns
  • Command-line trace recording
  • Programmatic trace analysis
Run automated profile → Use
performance-profiler
agent or
/axiom:profile
  • Records trace via xctrace
  • Exports and analyzes data
  • Reports findings with severity
图形化界面性能分析
/skill axiom-performance-profiling
  • Time Profiler(CPU分析)
  • Allocations(内存增长分析)
  • Core Data性能分析(N+1查询问题)
  • 工具选择决策树
自动化性能分析(CLI)
/skill axiom-xctrace-ref
  • 无头xctrace性能分析
  • CI/CD集成模式
  • 命令行跟踪记录
  • 程序化跟踪分析
运行自动化性能分析 → 使用
performance-profiler
agent或
/axiom:profile
  • 通过xctrace记录跟踪数据
  • 导出并分析数据
  • 生成带严重级别的分析报告

Hang/Freeze Issues

卡顿/冻结问题

App hangs or freezes
/skill axiom-hang-diagnostics
  • UI unresponsive for >1 second
  • Main thread blocked (busy or waiting)
  • Decision tree: busy vs blocked diagnosis
  • Time Profiler vs System Trace selection
  • 8 common hang patterns with fixes
  • Watchdog terminations
应用卡顿或冻结
/skill axiom-hang-diagnostics
  • UI无响应时间超过1秒
  • 主线程阻塞(繁忙或等待状态)
  • 决策树:繁忙 vs 阻塞诊断
  • Time Profiler与System Trace工具选择
  • 8种常见卡顿模式及修复方案
  • Watchdog终止问题

Energy Issues

能耗问题

Battery drain, high energy
/skill axiom-energy
  • Power Profiler workflow
  • Subsystem diagnosis (CPU/GPU/Network/Location/Display)
  • Anti-pattern fixes
  • Background execution optimization
Symptom-based diagnosis
/skill axiom-energy-diag
  • "App at top of Battery Settings"
  • "Device gets hot"
  • "Background battery drain"
  • Time-cost analysis for each path
API reference with code
/skill axiom-energy-ref
  • Complete WWDC code examples
  • Timer, network, location efficiency
  • BGContinuedProcessingTask (iOS 26)
  • MetricKit setup
电池耗电快、高能耗
/skill axiom-energy
  • Power Profiler工作流
  • 子系统诊断(CPU/GPU/网络/定位/显示)
  • 反模式修复
  • 后台执行优化
基于症状的诊断
/skill axiom-energy-diag
  • "电池设置中应用能耗排名靠前"
  • "设备发热"
  • "后台电池耗电快"
  • 各诊断路径的时间成本分析
带代码示例的API参考
/skill axiom-energy-ref
  • 完整WWDC代码示例
  • 定时器、网络、定位效率优化
  • BGContinuedProcessingTask(iOS 26)
  • MetricKit配置

MetricKit Integration

MetricKit集成

MetricKit API reference
/skill axiom-metrickit-ref
  • MXMetricPayload parsing
  • MXDiagnosticPayload (crashes, hangs)
  • Field performance data collection
  • Integration with crash reporting
MetricKit API参考
/skill axiom-metrickit-ref
  • MXMetricPayload解析
  • MXDiagnosticPayload(崩溃、卡顿)
  • 现场性能数据收集
  • 与崩溃报告系统集成

Decision Tree

决策树

  1. Memory leak (Swift)? → memory-debugging
  2. Memory leak (Objective-C blocks)? → objc-block-retain-cycles
  3. App hang/freeze (UI unresponsive >1s)? → hang-diagnostics
  4. Battery drain (know the symptom)? → energy-diag
  5. Battery drain (need API reference)? → energy-ref
  6. Battery drain (general)? → energy
  7. MetricKit setup/parsing? → metrickit-ref
  8. Profile with GUI (Instruments)? → performance-profiling
  9. Profile with CLI (xctrace)? → xctrace-ref
  10. Run automated profile now? → performance-profiler agent
  11. General slow/lag? → performance-profiling
  1. 内存泄漏(Swift)?→ memory-debugging
  2. 内存泄漏(Objective-C blocks)?→ objc-block-retain-cycles
  3. 应用卡顿/冻结(UI无响应>1秒)?→ hang-diagnostics
  4. 电池耗电快(已知症状)?→ energy-diag
  5. 电池耗电快(需要API参考)?→ energy-ref
  6. 电池耗电快(通用情况)?→ energy
  7. MetricKit配置/解析?→ metrickit-ref
  8. 使用图形化界面(Instruments)分析性能?→ performance-profiling
  9. 使用命令行(xctrace)分析性能?→ xctrace-ref
  10. 立即运行自动化性能分析?→ performance-profiler agent
  11. 通用运行缓慢/卡顿?→ performance-profiling

Anti-Rationalization

常见误区纠正

ThoughtReality
"I know it's a memory leak, let me find it"Memory leaks have 6 patterns. memory-debugging diagnoses the right one in 15 min vs 2 hours.
"I'll just run Time Profiler"Wrong Instruments template wastes time. performance-profiling selects the right tool first.
"Battery drain is probably the network layer"Energy issues span 8 subsystems. energy skill diagnoses the actual cause.
"App feels slow, I'll optimize later"Performance issues compound. Profiling now saves exponentially more time later.
"It's just a UI freeze, probably a slow API call"Freezes have busy vs blocked causes. hang-diagnostics has a decision tree for both.
错误想法实际情况
"我知道是内存泄漏,自己找就行"内存泄漏有6种模式,使用memory-debugging技能可在15分钟内定位正确模式,而自行排查可能需要2小时。
"我直接运行Time Profiler就行"选择错误的Instruments模板会浪费时间,performance-profiling技能会先帮你选择合适的工具。
"电池耗电快可能是网络层的问题"能耗问题涉及8个子系统,energy技能会诊断出真正的原因。
"应用有点慢,以后再优化"性能问题会不断恶化,现在进行性能分析能节省后续大量时间。
"只是UI冻结,可能是API调用慢"冻结分为繁忙和阻塞两种原因,hang-diagnostics技能有针对这两种情况的决策树。

Critical Patterns

关键模式

Memory Debugging (memory-debugging):
  • 6 leak patterns: timers, observers, closures, delegates, view callbacks, PhotoKit
  • Instruments workflows
  • Leak vs caching distinction
Performance Profiling (performance-profiling):
  • Time Profiler for CPU bottlenecks
  • Allocations for memory growth
  • Core Data SQL logging for N+1 queries
  • Self Time vs Total Time
Energy Optimization (energy):
  • Power Profiler subsystem diagnosis
  • 8 anti-patterns: timers, polling, location, animations, background, network, GPU, disk
  • Audit checklists by subsystem
  • Pressure scenarios for deadline resistance
内存调试(memory-debugging):
  • 6种泄漏模式:定时器、观察者、闭包、代理、视图回调、PhotoKit
  • Instruments工作流
  • 泄漏与缓存的区别
性能分析(performance-profiling):
  • 使用Time Profiler分析CPU瓶颈
  • 使用Allocations分析内存增长
  • Core Data SQL日志排查N+1查询问题
  • Self Time与Total Time的区别
能耗优化(energy):
  • Power Profiler子系统诊断
  • 8种反模式:定时器、轮询、定位、动画、后台执行、网络、GPU、磁盘
  • 各子系统的审计清单
  • deadline抵抗的压力场景

Example Invocations

调用示例

User: "My app's memory usage keeps growing" → Invoke:
/skill axiom-memory-debugging
User: "I have a memory leak but deinit isn't being called" → Invoke:
/skill axiom-memory-debugging
User: "My app feels slow, where do I start?" → Invoke:
/skill axiom-performance-profiling
User: "My Objective-C block callback is leaking" → Invoke:
/skill axiom-objc-block-retain-cycles
User: "My app drains battery quickly" → Invoke:
/skill axiom-energy
User: "Users say the device gets hot when using my app" → Invoke:
/skill axiom-energy-diag
User: "What's the best way to implement location tracking efficiently?" → Invoke:
/skill axiom-energy-ref
User: "Profile my app's CPU usage" → Use:
performance-profiler
agent (or
/axiom:profile
)
User: "How do I run xctrace from the command line?" → Invoke:
/skill axiom-xctrace-ref
User: "I need headless profiling for CI/CD" → Invoke:
/skill axiom-xctrace-ref
User: "My app hangs sometimes" → Invoke:
/skill axiom-hang-diagnostics
User: "The UI freezes and becomes unresponsive" → Invoke:
/skill axiom-hang-diagnostics
User: "Main thread is blocked, how do I diagnose?" → Invoke:
/skill axiom-hang-diagnostics
User: "How do I set up MetricKit?" → Invoke:
/skill axiom-metrickit-ref
User: "How do I parse MXMetricPayload?" → Invoke:
/skill axiom-metrickit-ref
用户:"我的应用内存占用持续增加" → 调用:
/skill axiom-memory-debugging
用户:"我遇到了内存泄漏,但deinit方法没有被调用" → 调用:
/skill axiom-memory-debugging
用户:"我的应用运行缓慢,该从哪里开始排查?" → 调用:
/skill axiom-performance-profiling
用户:"我的Objective-C block回调出现了泄漏" → 调用:
/skill axiom-objc-block-retain-cycles
用户:"我的应用电池耗电很快" → 调用:
/skill axiom-energy
用户:"用户反馈使用应用时设备发热" → 调用:
/skill axiom-energy-diag
用户:"如何高效实现定位跟踪?" → 调用:
/skill axiom-energy-ref
用户:"分析我的应用CPU使用率" → 使用:
performance-profiler
agent或
/axiom:profile
用户:"如何从命令行运行xctrace?" → 调用:
/skill axiom-xctrace-ref
用户:"我需要为CI/CD配置无头性能分析" → 调用:
/skill axiom-xctrace-ref
用户:"我的应用有时会卡顿" → 调用:
/skill axiom-hang-diagnostics
用户:"UI冻结且无响应" → 调用:
/skill axiom-hang-diagnostics
用户:"主线程被阻塞,该如何诊断?" → 调用:
/skill axiom-hang-diagnostics
用户:"如何配置MetricKit?" → 调用:
/skill axiom-metrickit-ref
用户:"如何解析MXMetricPayload?" → 调用:
/skill axiom-metrickit-ref