agentsclimarketplace

Performance profiling

Skill nota-america/forgecat-agent-profiles/profiles/mengto/skills/mango_skills_agent-skills-codex/for-forgecat/skills/performance-profiling

Production-ready AI agent profiles for Claude Code, Cursor, and Codex. Search, install, and contribute ForgeCat packages.

Install
npx -y skills add nota-america/forgecat-agent-profiles --skill performance-profiling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 24 stars24 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Guide performance profiling for Apple platform apps with Instruments, Xcode diagnostics, and MetricKit. Use when investigating app hangs, stutters, high CPU, memory leaks, memory growth, OOM crashes, slow launch, battery drain, thermal issues, App Store performance readiness, or when adding os_signpost and measurement hooks.

SKILL.md

6.0 KB, as published. Nobody here has run it

Performance Profiling

Use this skill to diagnose Apple app performance issues systematically, pick the right profiling workflow, apply targeted fixes, and verify the change with real measurements.

Decision Tree

Choose the reference file before changing code:

What performance problem are you investigating?

+ App hangs, stutters, dropped frames, slow UI, high CPU
  -> Read references/time-profiler.md

+ High memory, leaks, OOM crashes, growing footprint
  -> Read references/memory-profiling.md

+ Slow cold launch, warm launch, resume, or time to first frame
  -> Read references/launch-optimization.md

+ Battery drain, thermal throttling, background energy, network waste
  -> Read references/energy-diagnostics.md

+ General "app feels slow"
  -> Start with references/time-profiler.md, then references/memory-profiling.md

+ Pre-release performance audit
  -> Read all reference files and use the review checklist below

Quick Reference

ProblemInstrument / ToolKey MetricReference
UI hangs over 250 msTime Profiler + HangsHang duration, main thread stackreferences/time-profiler.md
High CPU usageTime ProfilerCPU percent by function, call tree weightreferences/time-profiler.md
Memory leakLeaks + Memory GraphLeaked bytes, retain cycle pathsreferences/memory-profiling.md
Memory growthAllocationsLive bytes, generation analysisreferences/memory-profiling.md
Slow launchApp LaunchTime to first frame, pre-main, post-mainreferences/launch-optimization.md
Battery drainEnergy LogEnergy impact, CPU/GPU/network activityreferences/energy-diagnostics.md
Thermal issuesActivity Monitor, InstrumentsThermal state transitionsreferences/energy-diagnostics.md
Network wasteNetwork profilerRedundant fetches, payload sizereferences/energy-diagnostics.md

Workflow

  1. Identify the performance category from the user report, traces, logs, or code path.
  2. Read only the matching reference file unless the issue is broad or unclear.
  3. Prefer real device profiling with a Release build and representative data.
  4. Inspect the code path named by the profile before proposing a fix.
  5. Apply the smallest targeted fix that addresses the measured bottleneck.
  6. Re-profile or add a repeatable measurement to confirm the improvement.

Profiling Ground Rules

  • Profile on device when possible; Simulator uses host CPU and memory.
  • Use Release configuration because optimizations can change hot paths.
  • Reproduce with representative data, not empty databases or toy assets.
  • Close unrelated apps to reduce noise during profiling.
  • Keep measurements before and after the fix so the outcome is concrete.
  • Add os_signpost markers when a workflow needs ongoing timing visibility.

Xcode Diagnostics

Recommend relevant Scheme > Run > Diagnostics settings when they match the suspected issue:

SettingUse For
Main Thread CheckerUI work off the main thread
Thread SanitizerData races and unsafe shared state
Address SanitizerBuffer overflows and use-after-free
Malloc Stack LoggingAllocation call stacks
Zombie ObjectsMessages to deallocated objects

MetricKit Hook

Suggest MetricKit for production monitoring of launch, responsiveness, memory, and diagnostics:

import MetricKit

final class PerformanceReporter: NSObject, MXMetricManagerSubscriber {
    func startCollecting() {
        MXMetricManager.shared.add(self)
    }

    func didReceive(_ payloads: [MXMetricPayload]) {
        for payload in payloads {
            if let launch = payload.applicationLaunchMetrics {
                log("Resume time: \(launch.histogrammedResumeTime)")
            }
            if let responsiveness = payload.applicationResponsivenessMetrics {
                log("Hang time: \(responsiveness.histogrammedApplicationHangTime)")
            }
            if let memory = payload.memoryMetrics {
                log("Peak memory: \(memory.peakMemoryUsage)")
            }
        }
    }

    func didReceive(_ payloads: [MXDiagnosticPayload]) {
        for payload in payloads {
            if let hangs = payload.hangDiagnostics {
                for hang in hangs {
                    log("Hang: \(hang.callStackTree)")
                }
            }
        }
    }
}

Review Checklist

Responsiveness:

  • No synchronous work on the main thread over 100 ms.
  • No file I/O or network calls on the main thread.
  • Large Core Data or SwiftData fetches use background contexts.
  • Images decode off the main thread.
  • @MainActor is limited to code that truly needs UI access.

Memory:

  • No retain cycles in delegates, closures, observers, or async tasks.
  • Large resources are released when no longer visible.
  • Collections and caches are bounded.
  • autoreleasepool is used in tight loops that create Objective-C objects.

Launch:

  • No heavy work in init() of the @main App struct.
  • Non-essential initialization is deferred.
  • Dynamic frameworks are minimized where practical.
  • No synchronous network calls occur during launch.

Energy:

  • Background tasks use the appropriate BGTaskScheduler request type.
  • Location accuracy matches the product need.
  • Timers use tolerance so the system can coalesce wakeups.
  • Network requests are batched and cached where possible.

References

  • references/time-profiler.md: CPU profiling, hang detection, signpost API.
  • references/memory-profiling.md: Allocations, Leaks, Memory Graph debugger.
  • references/launch-optimization.md: Launch phases and cold/warm start optimization.
  • references/energy-diagnostics.md: Battery, thermal state, and network efficiency.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.