Mobile Performance Profiling

Mobile app performance analysis and optimization

509 stars

Best use case

Mobile Performance Profiling is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Mobile app performance analysis and optimization

Teams using Mobile Performance Profiling should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/mobile-perf/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/mobile-development/skills/mobile-perf/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/mobile-perf/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Mobile Performance Profiling Compares

Feature / AgentMobile Performance ProfilingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Mobile app performance analysis and optimization

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Mobile Performance Profiling Skill

## Overview

This skill provides mobile app performance analysis and optimization capabilities. It enables profiling with Xcode Instruments, Android Profiler, Flipper, and Flutter DevTools to identify and fix performance issues.

## Allowed Tools

- `bash` - Execute profiling tools and build commands
- `read` - Analyze performance reports and profiles
- `write` - Generate optimization configurations
- `edit` - Update performance-related code
- `glob` - Search for performance files
- `grep` - Search for patterns

## Capabilities

### Xcode Instruments

1. **Time Profiler**
   - Profile CPU usage
   - Identify hot paths
   - Analyze call trees
   - Measure function durations

2. **Allocations**
   - Track memory allocations
   - Identify memory leaks
   - Analyze retain cycles
   - Monitor heap growth

3. **Core Animation**
   - Profile rendering performance
   - Identify offscreen renders
   - Measure frame rates
   - Detect layer issues

### Android Profiler

4. **CPU Profiler**
   - Record method traces
   - Analyze thread activity
   - Identify CPU bottlenecks
   - Profile startup time

5. **Memory Profiler**
   - Track allocations
   - Capture heap dumps
   - Identify memory leaks
   - Analyze GC events

6. **Network Profiler**
   - Monitor requests
   - Analyze response times
   - Profile bandwidth usage

### React Native

7. **Flipper Performance**
   - Monitor React renders
   - Profile JavaScript thread
   - Analyze bridge communication
   - Track native modules

8. **Hermes Profiler**
   - Profile Hermes engine
   - Analyze bytecode execution
   - Optimize bundle size

### Flutter DevTools

9. **Performance Overlay**
   - Monitor frame rendering
   - Identify jank
   - Profile widget rebuilds
   - Analyze timeline

### Metrics

10. **App Startup**
    - Cold start optimization
    - Warm start measurement
    - Hot start profiling
    - Deferred initialization

11. **Memory Management**
    - Peak memory usage
    - Memory warnings handling
    - Image caching strategies
    - Object pooling

12. **Rendering Performance**
    - Frame rate maintenance
    - Scroll performance
    - Animation smoothness
    - Layout optimization

## Target Processes

- `mobile-performance-optimization.js` - Performance tuning
- `mobile-testing-strategy.js` - Performance testing
- `jetpack-compose-ui.js` - Compose optimization
- `swiftui-app-development.js` - SwiftUI optimization

## Dependencies

- Xcode Instruments
- Android Studio Profiler
- Flipper
- Flutter DevTools

## Usage Examples

### Instruments Command Line

```bash
# Record Time Profiler trace
xcrun xctrace record --device "iPhone 15 Pro" \
  --template "Time Profiler" \
  --attach "MyApp" \
  --time-limit 30s \
  --output ~/Desktop/profile.trace

# Export trace data
xcrun xctrace export --input ~/Desktop/profile.trace \
  --xpath '/trace-toc/run/tracks/track[@name="Time Profiler"]' \
  --output ~/Desktop/profile_data.xml
```

### Android Profiler Commands

```bash
# Capture CPU trace
adb shell am profile start com.example.myapp /data/local/tmp/profile.trace

# Stop and pull trace
adb shell am profile stop com.example.myapp
adb pull /data/local/tmp/profile.trace ./profile.trace

# Capture heap dump
adb shell am dumpheap com.example.myapp /data/local/tmp/heap.hprof
adb pull /data/local/tmp/heap.hprof ./heap.hprof
```

### React Native Performance Optimization

```typescript
// Optimize list rendering
import { FlashList } from '@shopify/flash-list';

const OptimizedList = () => {
  const renderItem = useCallback(({ item }) => (
    <MemoizedListItem item={item} />
  ), []);

  return (
    <FlashList
      data={items}
      renderItem={renderItem}
      estimatedItemSize={100}
      keyExtractor={item => item.id}
    />
  );
};

// Memoize expensive components
const MemoizedListItem = memo(({ item }) => {
  return (
    <View style={styles.item}>
      <Text>{item.title}</Text>
    </View>
  );
}, (prev, next) => prev.item.id === next.item.id);

// Optimize images
import FastImage from 'react-native-fast-image';

const OptimizedImage = ({ uri }) => (
  <FastImage
    source={{ uri, priority: FastImage.priority.normal }}
    resizeMode={FastImage.resizeMode.cover}
    style={styles.image}
  />
);
```

### SwiftUI Performance

```swift
// Optimize view updates
struct OptimizedView: View {
    @State private var items: [Item] = []

    var body: some View {
        List {
            ForEach(items) { item in
                ItemRow(item: item)
                    .equatable() // Prevent unnecessary redraws
            }
        }
    }
}

// Use Equatable for custom views
struct ItemRow: View, Equatable {
    let item: Item

    static func == (lhs: ItemRow, rhs: ItemRow) -> Bool {
        lhs.item.id == rhs.item.id
    }

    var body: some View {
        Text(item.title)
    }
}

// Lazy loading
struct LazyImageView: View {
    let url: URL

    var body: some View {
        AsyncImage(url: url) { phase in
            switch phase {
            case .empty:
                ProgressView()
            case .success(let image):
                image.resizable().aspectRatio(contentMode: .fit)
            case .failure:
                Image(systemName: "photo")
            @unknown default:
                EmptyView()
            }
        }
    }
}
```

### Compose Performance

```kotlin
// Optimize recomposition
@Composable
fun OptimizedList(items: List<Item>) {
    LazyColumn {
        items(
            items = items,
            key = { it.id }
        ) { item ->
            // Stable key prevents unnecessary recomposition
            ItemCard(item = item)
        }
    }
}

// Use derivedStateOf for computed values
@Composable
fun SearchableList(items: List<Item>, query: String) {
    val filteredItems by remember(items, query) {
        derivedStateOf {
            items.filter { it.title.contains(query, ignoreCase = true) }
        }
    }

    LazyColumn {
        items(filteredItems, key = { it.id }) { ItemCard(it) }
    }
}

// Use remember for expensive calculations
@Composable
fun ExpensiveView(data: ComplexData) {
    val processedData = remember(data) {
        expensiveCalculation(data)
    }

    Text(processedData.result)
}
```

## Quality Gates

- App startup < 2s (cold), < 1s (warm)
- Frame rate >= 60fps (120fps for ProMotion)
- Memory usage within platform limits
- No memory leaks detected
- Scroll performance smooth

## Related Skills

- `mobile-testing` - Performance testing
- `react-native-dev` - RN optimization
- `flutter-dart` - Flutter optimization
- `kotlin-compose` - Compose optimization

## Version History

- 1.0.0 - Initial release

Related Skills

web-performance

509
from a5c-ai/babysitter

Core Web Vitals optimization, Lighthouse audits, and performance monitoring.

performance-profiler

509
from a5c-ai/babysitter

Profile application performance including CPU, memory, and flame graph generation

performance-benchmark-suite

509
from a5c-ai/babysitter

SDK performance benchmarking and regression detection

k6 Performance Testing

509
from a5c-ai/babysitter

k6 load testing expertise for performance validation and analysis

JMeter Performance Testing

509
from a5c-ai/babysitter

Apache JMeter expertise for enterprise-grade load and performance testing

Appium Mobile Testing

509
from a5c-ai/babysitter

Appium mobile testing framework for iOS and Android automation

nodejs-profiling

509
from a5c-ai/babysitter

Expert skill for Node.js-specific profiling and optimization. Use V8 CPU profiler, analyze heap snapshots, configure clinic.js tools (Doctor, Flame, Bubbleprof), debug event loop blocking, analyze async hooks performance, and optimize V8 JIT compilation.

network-performance

509
from a5c-ai/babysitter

Expert skill for network performance analysis and optimization. Analyze packet captures, identify network latency bottlenecks, configure TCP tuning parameters, analyze connection pooling behavior, debug TLS handshake performance, and optimize HTTP/2 and HTTP/3 settings.

Mobile Offline Storage

509
from a5c-ai/babysitter

Cross-platform offline-first data management

Mobile Testing Frameworks

509
from a5c-ai/babysitter

Comprehensive mobile testing framework expertise

mobile-security

509
from a5c-ai/babysitter

Mobile application security skill for implementing OWASP MASVS compliance, secure storage, certificate pinning, biometric authentication, and security hardening across iOS and Android platforms.

Mobile Analytics

509
from a5c-ai/babysitter

Mobile app analytics and crash reporting integration