Performance Profiling logo

Performance Profiling

CommunityPopular
MengTo
performance-profiling

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.

Overview

PublisherMengTo
RepositorySkills
Skill nameperformance-profiling
Stars
6.1K
Forks
717
Bundled files
10
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by MengTo on GitHub. Read the source before you install it.

Installation

Install the Performance Profiling AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MengTo/Skills.git /tmp/Skills
mkdir -p .claude/skills
cp -r /tmp/Skills/agent-skills/codex/performance-profiling .claude/skills/performance-profiling
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Performance Profiling in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Performance Profiling on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Performance Profiling is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

text
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:

swift
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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Performance Profiling AI skill do?

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.

Why use Performance Profiling on TypingMind?

Because you install it once and use it with any model. Performance Profiling is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Performance Profiling in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MengTo/Skills/tree/main/agent-skills/codex/performance-profiling. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Performance Profiling?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Performance Profiling?

As many as you like. As long as a model supports skills, you can use Performance Profiling with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Performance Profiling AI skill free?

Yes. It is published on GitHub by MengTo under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇