Przejdź do treści
Biblioteka skilli
Programowanie · Analiza

performance-profiling

/performance-profiling

Prowadzi profilowanie aplikacji na platformy Apple z Instruments, diagnostyką Xcode i MetricKit: zawieszenia, CPU, wycieki pamięci, start aplikacji, bateria i os_signpost.

Repozytorium
Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
11
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Prowadzi profilowanie aplikacji na platformy Apple z Instruments, diagnostyką Xcode i MetricKit: zawieszenia, CPU, wycieki pamięci, start aplikacji, bateria i os_signpost.

Oryginalny opis (EN)

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.

Jak działa

  1. Decision Tree
  2. Quick Reference
  3. Workflow
  4. Profiling Ground Rules
  5. Xcode Diagnostics
  6. MetricKit Hook
  7. Review Checklist
  8. References
Sekcje z nagłówków SKILL.md, w oryginale · 146 linii, 790 słów
Podgląd SKILL.md
---
name: performance-profiling
description: 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.
---

# 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

| Problem | Instrument / Tool | Key Metric | Reference |
| --- | --- | --- | --- |
| UI hangs over 250 ms | Time Profiler + Hangs | Hang duration, main thread stack | `references/time-profiler.md` |
| High CPU usage | Time Profiler | CPU percent by function, call tree weight | `references/time-profiler.md` |
| Memory leak | Leaks + Memory Graph | Leaked bytes, retain cycle paths | `references/memory-profiling.md` |
| Memory growth | Allocations | Live bytes, generation analysis | `references/memory-profiling.md` |
| Slow launch | App Launch | Time to first frame, pre-main, post-main | `references/launch-optimization.md` |
| Battery drain | Energy Log | Energy impact, CPU/GPU/network activity | `references/energy-diagnostics.md` |
| Thermal issues | Activity Monitor, Instruments | Thermal state transitions | `references/energy-diagnostics.md` |
| Network waste | Network profiler | Redundant fetches, payload size | `references/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:

| Setting | Use For |
| --- | --- |
| Main Thread Checker | UI work off the main thread |
| Thread Sanitizer | Data races and unsafe shared state |
| Address Sanitizer | Buffer overflows and use-after-free |
| Malloc Stack Logging | Allocation call stacks |
| Zombie Objects | Messages 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.
Pliki w paczce (11)
  • SKILL.md 6 KB
  • agents/openai.yaml 1 KB
  • demo/PROMPT.md 2 KB
  • demo/expected-output.md 1 KB
  • demo/index.html 4 KB
  • demo/input.md 1 KB
  • demo/preview.jpg 76 KB
  • references/energy-diagnostics.md 10 KB
  • references/launch-optimization.md 10 KB
  • references/memory-profiling.md 9 KB
  • references/time-profiler.md 6 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · MengTo/Skills100MIT
akillness/jeo-skills100MIT
Reprograme/redevkit100MIT
HeshamFS/materials-simulation-skills100Apache-2.0
charierefiedler/ronce-racine100MIT
Gattic/GatPi-Harness100MIT
reddygopalkrishna/developer-agent-skills100MIT
jeffersonvalente/cardume100MIT
alisinadevelo/md-files100MIT

Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 13.11.2026 · wersja paczki f290c474240b (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100axiom-performance
    Diagnozuje problemy wydajności aplikacji Apple, gdy działa wolno, rośnie pamięć lub szybko schodzi bateria: wycieki pamięci, profilowanie, Instruments, cykle retain i optymalizacja.
  • 100axiom-performance
    Diagnozuje problemy wydajności aplikacji Apple, gdy działa wolno, rośnie pamięć lub szybko schodzi bateria: wycieki pamięci, profilowanie, Instruments, cykle retain i optymalizacja.
  • 100mobile-app-performance-fps-memory-profiling
    Profiluje aplikację mobilną pod kątem spadków klatek, wycieków pamięci, skoków CPU i zużycia baterii w Instruments i Android Profiler.
  • 90xcode-game-profiling-workflow
    Prowadzi profilowanie gier Apple i zbieranie dowodów wydajności w Xcode i Instruments: frame pacing, stutter, FPS, Time Profiler, szablony Game Performance i Game Memory.
  • 95debugging-instruments
    Pomaga debugować aplikacje iOS i profilować wydajność przez LLDB, Memory Graph Debugger i Instruments: awarie, wycieki pamięci, zawieszenia i wolne renderowanie.
  • 90performance
    Wspiera profilowanie wydajności i debugowanie SwiftUI: Instruments, zawieszenia, problemy z pamięcią, wolne starty, zużycie energii, zbędne przerysowania i tożsamość widoków.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.