AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Performance Instruments

skill-markdavidgan-apple-dev-skills-performance-instruments · by markdavidgan

Diagnose and fix iOS performance — launch time, main-thread hangs and scroll hitches, memory growth and leaks, and energy, using Instruments, os_signpost, and MetricKit field data. Use when the app is slow, janky, or battery-hungry, when investigating launch time, frame drops, retain cycles, or memory warnings, or when profiling with Instruments. Trigger on "slow", "laggy", "hang", "hitch", "memo…

No reviews yet
0 installs
43 views
0.0% view→install

Install

$ agentstack add skill-markdavidgan-apple-dev-skills-performance-instruments

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-markdavidgan-apple-dev-skills-performance-instruments)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Performance Instruments? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Performance & Instruments

Measure first, then fix the thing the measurement points at. Guessing at performance wastes days. Pair with ios-test (perf tests) and ios-standards (concurrency).

> Rule: never optimize without a profile. A 2-line fix at the real hot spot beats a week of speculative micro-optimization elsewhere.


Pick the right instrument

| Problem | Instrument / tool | |---------|-------------------| | CPU hot spots, "where is time going" | Time Profiler | | App launch breakdown | App Launch template | | Main-thread stalls (UI freezes) | Hangs / Thread State | | Dropped frames while scrolling/animating | Animation Hitches / SwiftUI | | Memory growth, abandoned memory | Allocations + Leaks + Memory Graph | | Battery / wakeups / networking | Energy Log, Points of Interest | | Real-world data from users | MetricKit (MXMetricManager) |

Profile a Release/optimized build on a real device — Debug builds and the simulator lie about performance.


Launch time (the first impression)

Target ~250ms (user sees a freeze). A hitch** = a frame misses its deadline (stutter). On ProMotion (120Hz) the per-frame budget is ~8ms, so hitches are easier to hit.

  • Get work off the main thread. Heavy decoding, file I/O, image resizing, JSON parsing → background (an actor or Task.detached), then hop back to @MainActor for UI only. See ios-standards.
  • Don't block on await of slow work inside view updates. Load asynchronously and render a placeholder.
  • In lists: pre-size rows, avoid synchronous image decode, use lazy stacks/List recycling.
  • The Hangs instrument (and Xcode's runtime "Hang" warnings) pinpoint the blocking call stack.

Memory

  • Leaks (cycles): the usual culprit is a closure capturing self strongly. Use [weak self] in escaping closures, delegates, and Tasks that outlive the view. The Memory Graph Debugger (Xcode → Debug Memory Graph) shows retain cycles visually; Leaks flags them live.
  • Abandoned memory / growth: Allocations with "Mark Generation" — repeat an action, mark, and see what never frees. Caches without limits are a classic.
  • Respond to memory pressure; don't cache unbounded. Large images: downsample to display size before keeping them.

MetricKit — performance from real users

Instruments shows your device; MetricKit shows the field.

import MetricKit
final class Metrics: NSObject, MXMetricManagerSubscriber {
    func didReceive(_ payloads: [MXMetricPayload]) { /* launch, hang, hitch, memory, disk, energy */ }
    func didReceive(_ payloads: [MXDiagnosticPayload]) { /* crash, hang, CPU-exception diagnostics */ }
}
// MXMetricManager.shared.add(subscriber)

Payloads arrive ~once/day. Aggregate applicationLaunchMetrics, applicationHangTime, animationMetrics (hitch ratio), and memoryMetrics to catch regressions you'd never reproduce locally. Feed these into your analytics (see app-analytics).


Workflow (/perf-audit)

  1. Reproduce the complaint on a real device, Release build.
  2. Pick the instrument for the symptom (table above) and capture a trace.
  3. Find the single biggest contributor; fix it; re-measure to confirm the win.
  4. Add a signpost or perf test (ios-test) so the regression can't silently return.
  5. Check MetricKit trends after release to verify the fix holds in the field.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.