[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D8Y4AJAXV5JQN0VAMCD9G4":3,"skill-same:01M7D8Y4AJAXV5JQN0VAMCD9G4":87},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":65,"commitSha":66,"skillDirectory":67,"forksCount":14,"repositoryHtmlUrl":68,"repositoryHomepageUrl":6,"ownerHtmlUrl":69,"ownerBlogUrl":70,"ownerDescription":71,"updatedAt":72,"install":73,"resources":86},"01M7D8Y4AJAXV5JQN0VAMCD9G4","Mobile Performance Testing",null,"Mobile application performance testing including app launch time, frame rendering, memory profiling, battery consumption, network throttling, and crash analytics using Appium, XCTest, and Espresso with real device testing.","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fmobile-performance-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: Mobile Performance Testing\ndescription: Mobile application performance testing including app launch time, frame rendering, memory profiling, battery consumption, network throttling, and crash analytics using Appium, XCTest, and Espresso with real device testing.\nversion: 1.0.0\nauthor: thetestingacademy\nlicense: MIT\ntags: [mobile-performance, app-launch-time, frame-rendering, memory-profiling, battery-testing, network-throttling, appium, espresso, xctest, crash-analytics]\ntestingTypes: [performance, mobile, e2e, integration]\nframeworks: [appium, espresso, xctest, detox]\nlanguages: [typescript, javascript, kotlin, swift]\ndomains: [mobile, performance, ios, android]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt, gemini-cli, amp]\n---\n\n# Mobile Performance Testing Skill\n\nYou are an expert in mobile application performance testing. When the user asks you to test mobile app performance, measure launch times, profile memory usage, test under network conditions, or set up mobile performance monitoring, follow these detailed instructions.\n\n## Core Principles\n\n1. **Real device testing over emulators** -- Performance measurements on emulators do not represent real-world behavior. Always validate on real devices with representative hardware.\n2. **Cold start and warm start measurement** -- Measure both cold start (app loaded from scratch) and warm start (app resumed from background) times. Users experience both.\n3. **Frame rendering performance** -- Target 60fps (16.6ms per frame) for smooth UI. Measure jank frames, frozen frames, and total frame drop percentage.\n4. **Memory profiling under load** -- Monitor memory allocation, peak usage, and garbage collection frequency during typical and stress scenarios.\n5. **Network-aware performance** -- Test on 2G, 3G, 4G, and WiFi conditions. Many users operate on slow or unreliable connections.\n6. **Battery consumption measurement** -- Track CPU wake locks, network activity, GPS usage, and background processing that drain battery.\n7. **Baseline comparison** -- Every performance test must compare against a baseline from the previous release to detect regressions.\n\n## Project Structure\n\n```\nmobile-perf-tests\u002F\n  android\u002F\n    launch-time\u002F\n      cold-start.test.ts\n      warm-start.test.ts\n      deep-link-start.test.ts\n    rendering\u002F\n      frame-rate.test.ts\n      scroll-performance.test.ts\n      animation-jank.test.ts\n    memory\u002F\n      memory-leak-detection.test.ts\n      large-list-memory.test.ts\n      image-cache-memory.test.ts\n    network\u002F\n      slow-network.test.ts\n      offline-mode.test.ts\n      large-payload.test.ts\n    battery\u002F\n      background-drain.test.ts\n      location-tracking-drain.test.ts\n  ios\u002F\n    launch-time\u002F\n      cold-start.test.ts\n      warm-start.test.ts\n    rendering\u002F\n      frame-rate.test.ts\n      scroll-performance.test.ts\n    memory\u002F\n      memory-warnings.test.ts\n      image-cache.test.ts\n  helpers\u002F\n    performance-collector.ts\n    adb-helper.ts\n    network-throttler.ts\n    metrics-reporter.ts\n  baselines\u002F\n    android-baseline.json\n    ios-baseline.json\n  config\u002F\n    device-profiles.ts\n    performance-thresholds.ts\n  reports\u002F\n    .gitkeep\n```\n\n## App Launch Time Testing\n\n```typescript\n\u002F\u002F android\u002Flaunch-time\u002Fcold-start.test.ts\nimport { describe, it, expect, beforeAll, afterAll } from 'vitest';\n\ninterface LaunchMetrics {\n  coldStartMs: number;\n  timeToFirstFrameMs: number;\n  timeToInteractiveMs: number;\n  totalDrawnFrames: number;\n}\n\ndescribe('Android Cold Start Performance', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const LAUNCH_ACTIVITY = '.MainActivity';\n  const ITERATIONS = 10;\n  const THRESHOLD_MS = 2000;\n\n  it('should launch within threshold on average', async () => {\n    const measurements: number[] = [];\n\n    for (let i = 0; i \u003C ITERATIONS; i++) {\n      \u002F\u002F Force stop the app\n      await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n      await sleep(2000);\n\n      \u002F\u002F Clear app from memory\n      await execAdb(`shell pm clear ${APP_PACKAGE}`);\n      await sleep(1000);\n\n      \u002F\u002F Measure cold start\n      const output = await execAdb(\n        `shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`\n      );\n\n      const totalTime = parseLaunchTime(output);\n      measurements.push(totalTime);\n    }\n\n    const average = measurements.reduce((a, b) => a + b, 0) \u002F measurements.length;\n    const p95 = measurements.sort((a, b) => a - b)[Math.floor(measurements.length * 0.95)];\n    const max = Math.max(...measurements);\n\n    console.log(`Cold start: avg=${average.toFixed(0)}ms, p95=${p95}ms, max=${max}ms`);\n\n    expect(average).toBeLessThan(THRESHOLD_MS);\n    expect(p95).toBeLessThan(THRESHOLD_MS * 1.5);\n  });\n\n  it('should render first frame within 1 second', async () => {\n    await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n    await sleep(2000);\n\n    const startTime = Date.now();\n    await execAdb(`shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`);\n\n    const output = await execAdb('shell dumpsys gfxinfo ' + APP_PACKAGE);\n    const firstFrameTime = parseFirstFrameTime(output);\n\n    expect(firstFrameTime).toBeLessThan(1000);\n  });\n\n  it('should show improvement over baseline', async () => {\n    const baseline = await loadBaseline('cold-start');\n    const current = await measureColdStart();\n\n    const regression = ((current - baseline) \u002F baseline) * 100;\n    console.log(`Baseline: ${baseline}ms, Current: ${current}ms, Change: ${regression.toFixed(1)}%`);\n\n    expect(regression).toBeLessThan(10); \u002F\u002F Allow up to 10% regression\n  });\n});\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(`adb ${command}`, { encoding: 'utf-8' });\n}\n\nfunction parseLaunchTime(output: string): number {\n  const match = output.match(\u002FTotalTime:\\s*(\\d+)\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nfunction parseFirstFrameTime(output: string): number {\n  const match = output.match(\u002FJanky frames:\\s*\\d+.*?(\\d+)ms\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nasync function loadBaseline(metric: string): Promise\u003Cnumber> {\n  const { readFileSync } = await import('fs');\n  const baselines = JSON.parse(readFileSync('baselines\u002Fandroid-baseline.json', 'utf-8'));\n  return baselines[metric] || 0;\n}\n\nasync function measureColdStart(): Promise\u003Cnumber> {\n  const APP_PACKAGE = 'com.example.app';\n  const LAUNCH_ACTIVITY = '.MainActivity';\n  await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n  await sleep(2000);\n  const output = await execAdb(`shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`);\n  return parseLaunchTime(output);\n}\n\nfunction sleep(ms: number): Promise\u003Cvoid> {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n```\n\n## Memory Profiling\n\n```typescript\n\u002F\u002F android\u002Fmemory\u002Fmemory-leak-detection.test.ts\nimport { describe, it, expect } from 'vitest';\n\ndescribe('Memory Leak Detection', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const THRESHOLD_MB = 200;\n\n  it('should not leak memory during navigation cycles', async () => {\n    const initialMemory = await getAppMemory(APP_PACKAGE);\n    const memorySnapshots: number[] = [initialMemory];\n\n    \u002F\u002F Simulate 20 navigation cycles\n    for (let i = 0; i \u003C 20; i++) {\n      await navigateToScreen('home');\n      await navigateToScreen('profile');\n      await navigateToScreen('settings');\n      await navigateToScreen('home');\n\n      const memory = await getAppMemory(APP_PACKAGE);\n      memorySnapshots.push(memory);\n    }\n\n    \u002F\u002F Force garbage collection\n    await execAdb(`shell am dumpheap ${APP_PACKAGE} \u002Fdev\u002Fnull`);\n    await sleep(3000);\n\n    const finalMemory = await getAppMemory(APP_PACKAGE);\n    const memoryGrowth = finalMemory - initialMemory;\n\n    console.log(`Memory: initial=${initialMemory}MB, final=${finalMemory}MB, growth=${memoryGrowth}MB`);\n\n    \u002F\u002F Memory should not grow linearly\n    expect(finalMemory).toBeLessThan(THRESHOLD_MB);\n\n    \u002F\u002F Check for linear growth pattern (indicates leak)\n    const isLinearGrowth = checkLinearGrowth(memorySnapshots);\n    expect(isLinearGrowth).toBe(false);\n  });\n\n  it('should handle large image lists without OOM', async () => {\n    await navigateToScreen('image-gallery');\n\n    \u002F\u002F Scroll through 100 images\n    for (let i = 0; i \u003C 20; i++) {\n      await scrollDown();\n      await sleep(500);\n    }\n\n    const memory = await getAppMemory(APP_PACKAGE);\n    expect(memory).toBeLessThan(THRESHOLD_MB);\n\n    \u002F\u002F Check for OOM crashes\n    const crashes = await getRecentCrashes(APP_PACKAGE);\n    expect(crashes.filter((c: string) => c.includes('OutOfMemoryError'))).toHaveLength(0);\n  });\n});\n\nasync function getAppMemory(packageName: string): Promise\u003Cnumber> {\n  const output = await execAdb(`shell dumpsys meminfo ${packageName}`);\n  const match = output.match(\u002FTOTAL\\s+(\\d+)\u002F);\n  return match ? parseInt(match[1], 10) \u002F 1024 : 0; \u002F\u002F Convert KB to MB\n}\n\nfunction checkLinearGrowth(snapshots: number[]): boolean {\n  if (snapshots.length \u003C 5) return false;\n  const diffs = snapshots.slice(1).map((v, i) => v - snapshots[i]);\n  const avgDiff = diffs.reduce((a, b) => a + b, 0) \u002F diffs.length;\n  return avgDiff > 2 && diffs.every((d) => d > 0); \u002F\u002F Consistent positive growth\n}\n\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {\n  \u002F\u002F Use Appium or ADB to navigate\n}\n\nasync function scrollDown(): Promise\u003Cvoid> {\n  await execAdb('shell input swipe 500 1500 500 500 300');\n}\n\nasync function getRecentCrashes(packageName: string): Promise\u003Cstring[]> {\n  const output = await execAdb(`shell logcat -d -s AndroidRuntime:E | grep ${packageName}`);\n  return output.split('\\n').filter(Boolean);\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(`adb ${command}`, { encoding: 'utf-8' });\n}\n\nfunction sleep(ms: number): Promise\u003Cvoid> {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n```\n\n## Network Throttling Tests\n\n```typescript\n\u002F\u002F android\u002Fnetwork\u002Fslow-network.test.ts\nimport { describe, it, expect, beforeAll, afterAll } from 'vitest';\n\ndescribe('Slow Network Performance', () => {\n  const networkProfiles = {\n    '3G': { download: 750, upload: 250, latency: 100 },\n    '2G': { download: 50, upload: 25, latency: 300 },\n    'slow-wifi': { download: 2000, upload: 1000, latency: 50 },\n    'lossy': { download: 5000, upload: 2000, latency: 200 },\n  };\n\n  afterAll(async () => {\n    await disableNetworkThrottling();\n  });\n\n  it('should load main feed within 5s on 3G', async () => {\n    await setNetworkProfile(networkProfiles['3G']);\n\n    const startTime = Date.now();\n    await navigateToScreen('feed');\n    await waitForContentLoaded();\n    const loadTime = Date.now() - startTime;\n\n    console.log(`Feed load on 3G: ${loadTime}ms`);\n    expect(loadTime).toBeLessThan(5000);\n  });\n\n  it('should show loading indicator on slow connections', async () => {\n    await setNetworkProfile(networkProfiles['2G']);\n    await navigateToScreen('feed');\n\n    \u002F\u002F Check that loading indicator is shown\n    const hasLoadingIndicator = await checkElementVisible('loading-spinner');\n    expect(hasLoadingIndicator).toBe(true);\n  });\n\n  it('should gracefully handle offline mode', async () => {\n    await setAirplaneMode(true);\n    await navigateToScreen('feed');\n\n    const hasOfflineMessage = await checkElementVisible('offline-message');\n    expect(hasOfflineMessage).toBe(true);\n\n    await setAirplaneMode(false);\n  });\n\n  it('should retry failed requests on connection recovery', async () => {\n    await setAirplaneMode(true);\n    await navigateToScreen('feed');\n\n    await setAirplaneMode(false);\n    await sleep(5000);\n\n    const hasContent = await checkElementVisible('feed-content');\n    expect(hasContent).toBe(true);\n  });\n});\n\nasync function setNetworkProfile(profile: { download: number; upload: number; latency: number }): Promise\u003Cvoid> {\n  \u002F\u002F Use ADB network emulation or proxy tool\n  console.log(`Setting network: ${profile.download}kbps down, ${profile.upload}kbps up, ${profile.latency}ms latency`);\n}\n\nasync function disableNetworkThrottling(): Promise\u003Cvoid> {\n  console.log('Disabling network throttling');\n}\n\nasync function setAirplaneMode(enabled: boolean): Promise\u003Cvoid> {\n  const { execSync } = await import('child_process');\n  execSync(`adb shell settings put global airplane_mode_on ${enabled ? 1 : 0}`);\n  execSync(`adb shell am broadcast -a android.intent.action.AIRPLANE_MODE`);\n}\n\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {}\nasync function waitForContentLoaded(): Promise\u003Cvoid> { await sleep(100); }\nasync function checkElementVisible(id: string): Promise\u003Cboolean> { return true; }\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## Frame Rate Performance Testing\n\n```typescript\n\u002F\u002F android\u002Frendering\u002Fframe-rate.test.ts\nimport { describe, it, expect } from 'vitest';\n\ninterface FrameStats {\n  totalFrames: number;\n  jankFrames: number;\n  frozenFrames: number;\n  p50RenderTimeMs: number;\n  p95RenderTimeMs: number;\n  p99RenderTimeMs: number;\n  fps: number;\n}\n\ndescribe('Frame Rate Performance', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const TARGET_FPS = 60;\n  const MAX_JANK_PERCENTAGE = 5;\n\n  it('should maintain 60fps during list scrolling', async () => {\n    await resetFrameStats(APP_PACKAGE);\n    await navigateToScreen('product-list');\n\n    \u002F\u002F Scroll through the list for 10 seconds\n    for (let i = 0; i \u003C 20; i++) {\n      await execAdb('shell input swipe 500 1500 500 300 200');\n      await sleep(500);\n    }\n\n    const stats = await getFrameStats(APP_PACKAGE);\n\n    console.log(`FPS: ${stats.fps}, Jank: ${stats.jankFrames}\u002F${stats.totalFrames}`);\n    console.log(`Render times: p50=${stats.p50RenderTimeMs}ms, p95=${stats.p95RenderTimeMs}ms, p99=${stats.p99RenderTimeMs}ms`);\n\n    expect(stats.fps).toBeGreaterThanOrEqual(TARGET_FPS * 0.9); \u002F\u002F Allow 10% margin\n    const jankPercentage = (stats.jankFrames \u002F stats.totalFrames) * 100;\n    expect(jankPercentage).toBeLessThan(MAX_JANK_PERCENTAGE);\n  });\n\n  it('should not have frozen frames during navigation', async () => {\n    await resetFrameStats(APP_PACKAGE);\n\n    \u002F\u002F Navigate between screens\n    const screens = ['home', 'search', 'profile', 'settings', 'home'];\n    for (const screen of screens) {\n      await navigateToScreen(screen);\n      await sleep(1000);\n    }\n\n    const stats = await getFrameStats(APP_PACKAGE);\n    expect(stats.frozenFrames).toBe(0);\n  });\n\n  it('should maintain frame rate during animations', async () => {\n    await resetFrameStats(APP_PACKAGE);\n    await navigateToScreen('animations-demo');\n\n    \u002F\u002F Trigger multiple animations\n    await execAdb('shell input tap 500 500'); \u002F\u002F Trigger animation\n    await sleep(2000);\n    await execAdb('shell input tap 500 800'); \u002F\u002F Another animation\n    await sleep(2000);\n\n    const stats = await getFrameStats(APP_PACKAGE);\n    expect(stats.p95RenderTimeMs).toBeLessThan(16.67); \u002F\u002F Must be under one frame budget\n  });\n});\n\nasync function resetFrameStats(packageName: string): Promise\u003Cvoid> {\n  await execAdb(\\`shell dumpsys gfxinfo \\${packageName} reset\\`);\n}\n\nasync function getFrameStats(packageName: string): Promise\u003CFrameStats> {\n  const output = await execAdb(\\`shell dumpsys gfxinfo \\${packageName}\\`);\n\n  const totalMatch = output.match(\u002FTotal frames rendered: (\\\\d+)\u002F);\n  const jankMatch = output.match(\u002FJanky frames: (\\\\d+)\u002F);\n  const frozenMatch = output.match(\u002FNumber Missed Vsync: (\\\\d+)\u002F);\n\n  const totalFrames = totalMatch ? parseInt(totalMatch[1], 10) : 0;\n  const jankFrames = jankMatch ? parseInt(jankMatch[1], 10) : 0;\n  const frozenFrames = frozenMatch ? parseInt(frozenMatch[1], 10) : 0;\n\n  \u002F\u002F Parse frame timing histogram\n  const renderTimes = parseFrameTimings(output);\n  renderTimes.sort((a, b) => a - b);\n\n  return {\n    totalFrames,\n    jankFrames,\n    frozenFrames,\n    p50RenderTimeMs: percentile(renderTimes, 50),\n    p95RenderTimeMs: percentile(renderTimes, 95),\n    p99RenderTimeMs: percentile(renderTimes, 99),\n    fps: totalFrames > 0 ? Math.round(totalFrames \u002F 10) : 0,\n  };\n}\n\nfunction parseFrameTimings(output: string): number[] {\n  const lines = output.split('\\\\n');\n  const timings: number[] = [];\n  let inHistogram = false;\n\n  for (const line of lines) {\n    if (line.includes('HISTOGRAM')) inHistogram = true;\n    if (inHistogram && line.match(\u002F^\\\\d\u002F)) {\n      const parts = line.trim().split(\u002F\\\\s+\u002F);\n      if (parts.length >= 2) {\n        timings.push(parseFloat(parts[0]));\n      }\n    }\n  }\n\n  return timings;\n}\n\nfunction percentile(values: number[], p: number): number {\n  if (values.length === 0) return 0;\n  const index = Math.ceil(values.length * (p \u002F 100)) - 1;\n  return values[Math.max(0, index)];\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(\\`adb \\${command}\\`, { encoding: 'utf-8' });\n}\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {}\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## Battery Consumption Testing\n\n```typescript\n\u002F\u002F android\u002Fbattery\u002Fbackground-drain.test.ts\nimport { describe, it, expect } from 'vitest';\n\ndescribe('Battery Consumption', () => {\n  const APP_PACKAGE = 'com.example.app';\n\n  it('should not drain more than 2% battery in 30 minutes of background', async () => {\n    const initialBattery = await getBatteryLevel();\n\n    \u002F\u002F Launch app and send to background\n    await execAdb(\\`shell am start -n \\${APP_PACKAGE}\u002F.MainActivity\\`);\n    await sleep(5000);\n    await execAdb('shell input keyevent KEYCODE_HOME'); \u002F\u002F Send to background\n\n    \u002F\u002F Wait 30 minutes (or simulated time)\n    await sleep(30 * 60 * 1000);\n\n    const finalBattery = await getBatteryLevel();\n    const drain = initialBattery - finalBattery;\n\n    console.log(\\`Battery drain: \\${drain}% over 30 minutes\\`);\n    expect(drain).toBeLessThanOrEqual(2);\n  });\n\n  it('should release wake locks when backgrounded', async () => {\n    await execAdb(\\`shell am start -n \\${APP_PACKAGE}\u002F.MainActivity\\`);\n    await sleep(5000);\n    await execAdb('shell input keyevent KEYCODE_HOME');\n    await sleep(10000);\n\n    const wakeLocks = await getAppWakeLocks(APP_PACKAGE);\n    expect(wakeLocks).toBe(0);\n  });\n});\n\nasync function getBatteryLevel(): Promise\u003Cnumber> {\n  const output = await execAdb('shell dumpsys battery');\n  const match = output.match(\u002Flevel: (\\\\d+)\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nasync function getAppWakeLocks(packageName: string): Promise\u003Cnumber> {\n  const output = await execAdb(\\`shell dumpsys power | grep \\${packageName}\\`);\n  return (output.match(\u002FPARTIAL_WAKE_LOCK\u002Fg) || []).length;\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(\\`adb \\${command}\\`, { encoding: 'utf-8' });\n}\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## App Size Monitoring\n\n```typescript\n\u002F\u002F monitoring\u002Fapp-size.ts\nexport interface AppSizeReport {\n  totalSizeMB: number;\n  downloadSizeMB: number;\n  installSizeMB: number;\n  components: Array\u003C{\n    name: string;\n    sizeMB: number;\n    percentage: number;\n  }>;\n  thresholdStatus: 'pass' | 'warning' | 'fail';\n}\n\nexport function analyzeApkSize(apkPath: string): AppSizeReport {\n  \u002F\u002F Analyze APK\u002FAAB components\n  return {\n    totalSizeMB: 0,\n    downloadSizeMB: 0,\n    installSizeMB: 0,\n    components: [],\n    thresholdStatus: 'pass',\n  };\n}\n\nexport const APP_SIZE_THRESHOLDS = {\n  totalMB: { warning: 50, critical: 100 },\n  downloadMB: { warning: 30, critical: 60 },\n  dexFilesMB: { warning: 10, critical: 20 },\n  nativeLibsMB: { warning: 15, critical: 30 },\n  resourcesMB: { warning: 20, critical: 40 },\n};\n```\n\n## Best Practices\n\n1. **Test on real devices with representative hardware** -- Low-end and mid-range devices represent the majority of users. Do not only test on flagship phones.\n2. **Measure cold and warm start separately** -- Users experience both scenarios. Cold start matters for first impressions; warm start matters for daily usage.\n3. **Run performance tests multiple times** -- A single measurement is noisy. Run at least 10 iterations and report median and p95 values.\n4. **Test under realistic network conditions** -- Use network throttling to simulate 3G, 4G, and lossy WiFi connections.\n5. **Monitor memory across the entire user session** -- Brief memory spikes are acceptable. Continuous growth indicates leaks.\n6. **Establish baselines and track regressions** -- Store performance baselines per release and fail tests when regressions exceed thresholds.\n7. **Test with realistic data volumes** -- Empty lists and single items do not stress the app. Use hundreds of items with images and complex layouts.\n8. **Include battery impact in performance criteria** -- An app that drains 10% battery per hour will get uninstalled regardless of feature quality.\n9. **Automate performance tests in CI** -- Run performance tests on every release branch, not just manually before launch.\n10. **Profile before optimizing** -- Use Android Profiler and Xcode Instruments to identify actual bottlenecks instead of guessing.\n\n## Anti-Patterns\n\n1. **Only testing on emulators** -- Emulator performance does not represent real device behavior. GPU rendering, memory management, and CPU throttling differ significantly.\n2. **Measuring performance once** -- Single measurements are unreliable due to JIT compilation, background processes, and thermal throttling. Always aggregate multiple runs.\n3. **Ignoring low-end devices** -- Most users do not have flagship phones. Test on devices with 2-3GB RAM and mid-range processors.\n4. **Not testing offline scenarios** -- Users frequently lose connectivity. Apps that crash or hang without network are unusable.\n5. **Skipping scroll performance testing** -- Janky scrolling is the most user-visible performance issue. Always measure frame rates during scroll.\n6. **Testing only on WiFi** -- WiFi performance masks network-dependent bottlenecks. Always include 3G and 4G testing.\n7. **Not monitoring memory during long sessions** -- Memory leaks may not appear in 30-second tests. Simulate 5-10 minute user sessions.\n8. **Ignoring app size** -- Large APK\u002FIPA files increase download time, storage usage, and initial launch time. Monitor and set size budgets.\n9. **Not testing background behavior** -- Apps that consume CPU and network in the background drain battery and may be killed by the OS.\n10. **Comparing performance across different device models** -- Always compare same-device measurements across versions, not different devices in the same run.\n","# Mobile Performance Testing Skill\n\nYou are an expert in mobile application performance testing. When the user asks you to test mobile app performance, measure launch times, profile memory usage, test under network conditions, or set up mobile performance monitoring, follow these detailed instructions.\n\n## Core Principles\n\n1. **Real device testing over emulators** -- Performance measurements on emulators do not represent real-world behavior. Always validate on real devices with representative hardware.\n2. **Cold start and warm start measurement** -- Measure both cold start (app loaded from scratch) and warm start (app resumed from background) times. Users experience both.\n3. **Frame rendering performance** -- Target 60fps (16.6ms per frame) for smooth UI. Measure jank frames, frozen frames, and total frame drop percentage.\n4. **Memory profiling under load** -- Monitor memory allocation, peak usage, and garbage collection frequency during typical and stress scenarios.\n5. **Network-aware performance** -- Test on 2G, 3G, 4G, and WiFi conditions. Many users operate on slow or unreliable connections.\n6. **Battery consumption measurement** -- Track CPU wake locks, network activity, GPS usage, and background processing that drain battery.\n7. **Baseline comparison** -- Every performance test must compare against a baseline from the previous release to detect regressions.\n\n## Project Structure\n\n```\nmobile-perf-tests\u002F\n  android\u002F\n    launch-time\u002F\n      cold-start.test.ts\n      warm-start.test.ts\n      deep-link-start.test.ts\n    rendering\u002F\n      frame-rate.test.ts\n      scroll-performance.test.ts\n      animation-jank.test.ts\n    memory\u002F\n      memory-leak-detection.test.ts\n      large-list-memory.test.ts\n      image-cache-memory.test.ts\n    network\u002F\n      slow-network.test.ts\n      offline-mode.test.ts\n      large-payload.test.ts\n    battery\u002F\n      background-drain.test.ts\n      location-tracking-drain.test.ts\n  ios\u002F\n    launch-time\u002F\n      cold-start.test.ts\n      warm-start.test.ts\n    rendering\u002F\n      frame-rate.test.ts\n      scroll-performance.test.ts\n    memory\u002F\n      memory-warnings.test.ts\n      image-cache.test.ts\n  helpers\u002F\n    performance-collector.ts\n    adb-helper.ts\n    network-throttler.ts\n    metrics-reporter.ts\n  baselines\u002F\n    android-baseline.json\n    ios-baseline.json\n  config\u002F\n    device-profiles.ts\n    performance-thresholds.ts\n  reports\u002F\n    .gitkeep\n```\n\n## App Launch Time Testing\n\n```typescript\n\u002F\u002F android\u002Flaunch-time\u002Fcold-start.test.ts\nimport { describe, it, expect, beforeAll, afterAll } from 'vitest';\n\ninterface LaunchMetrics {\n  coldStartMs: number;\n  timeToFirstFrameMs: number;\n  timeToInteractiveMs: number;\n  totalDrawnFrames: number;\n}\n\ndescribe('Android Cold Start Performance', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const LAUNCH_ACTIVITY = '.MainActivity';\n  const ITERATIONS = 10;\n  const THRESHOLD_MS = 2000;\n\n  it('should launch within threshold on average', async () => {\n    const measurements: number[] = [];\n\n    for (let i = 0; i \u003C ITERATIONS; i++) {\n      \u002F\u002F Force stop the app\n      await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n      await sleep(2000);\n\n      \u002F\u002F Clear app from memory\n      await execAdb(`shell pm clear ${APP_PACKAGE}`);\n      await sleep(1000);\n\n      \u002F\u002F Measure cold start\n      const output = await execAdb(\n        `shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`\n      );\n\n      const totalTime = parseLaunchTime(output);\n      measurements.push(totalTime);\n    }\n\n    const average = measurements.reduce((a, b) => a + b, 0) \u002F measurements.length;\n    const p95 = measurements.sort((a, b) => a - b)[Math.floor(measurements.length * 0.95)];\n    const max = Math.max(...measurements);\n\n    console.log(`Cold start: avg=${average.toFixed(0)}ms, p95=${p95}ms, max=${max}ms`);\n\n    expect(average).toBeLessThan(THRESHOLD_MS);\n    expect(p95).toBeLessThan(THRESHOLD_MS * 1.5);\n  });\n\n  it('should render first frame within 1 second', async () => {\n    await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n    await sleep(2000);\n\n    const startTime = Date.now();\n    await execAdb(`shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`);\n\n    const output = await execAdb('shell dumpsys gfxinfo ' + APP_PACKAGE);\n    const firstFrameTime = parseFirstFrameTime(output);\n\n    expect(firstFrameTime).toBeLessThan(1000);\n  });\n\n  it('should show improvement over baseline', async () => {\n    const baseline = await loadBaseline('cold-start');\n    const current = await measureColdStart();\n\n    const regression = ((current - baseline) \u002F baseline) * 100;\n    console.log(`Baseline: ${baseline}ms, Current: ${current}ms, Change: ${regression.toFixed(1)}%`);\n\n    expect(regression).toBeLessThan(10); \u002F\u002F Allow up to 10% regression\n  });\n});\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(`adb ${command}`, { encoding: 'utf-8' });\n}\n\nfunction parseLaunchTime(output: string): number {\n  const match = output.match(\u002FTotalTime:\\s*(\\d+)\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nfunction parseFirstFrameTime(output: string): number {\n  const match = output.match(\u002FJanky frames:\\s*\\d+.*?(\\d+)ms\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nasync function loadBaseline(metric: string): Promise\u003Cnumber> {\n  const { readFileSync } = await import('fs');\n  const baselines = JSON.parse(readFileSync('baselines\u002Fandroid-baseline.json', 'utf-8'));\n  return baselines[metric] || 0;\n}\n\nasync function measureColdStart(): Promise\u003Cnumber> {\n  const APP_PACKAGE = 'com.example.app';\n  const LAUNCH_ACTIVITY = '.MainActivity';\n  await execAdb(`shell am force-stop ${APP_PACKAGE}`);\n  await sleep(2000);\n  const output = await execAdb(`shell am start-activity -W -n ${APP_PACKAGE}\u002F${LAUNCH_ACTIVITY}`);\n  return parseLaunchTime(output);\n}\n\nfunction sleep(ms: number): Promise\u003Cvoid> {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n```\n\n## Memory Profiling\n\n```typescript\n\u002F\u002F android\u002Fmemory\u002Fmemory-leak-detection.test.ts\nimport { describe, it, expect } from 'vitest';\n\ndescribe('Memory Leak Detection', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const THRESHOLD_MB = 200;\n\n  it('should not leak memory during navigation cycles', async () => {\n    const initialMemory = await getAppMemory(APP_PACKAGE);\n    const memorySnapshots: number[] = [initialMemory];\n\n    \u002F\u002F Simulate 20 navigation cycles\n    for (let i = 0; i \u003C 20; i++) {\n      await navigateToScreen('home');\n      await navigateToScreen('profile');\n      await navigateToScreen('settings');\n      await navigateToScreen('home');\n\n      const memory = await getAppMemory(APP_PACKAGE);\n      memorySnapshots.push(memory);\n    }\n\n    \u002F\u002F Force garbage collection\n    await execAdb(`shell am dumpheap ${APP_PACKAGE} \u002Fdev\u002Fnull`);\n    await sleep(3000);\n\n    const finalMemory = await getAppMemory(APP_PACKAGE);\n    const memoryGrowth = finalMemory - initialMemory;\n\n    console.log(`Memory: initial=${initialMemory}MB, final=${finalMemory}MB, growth=${memoryGrowth}MB`);\n\n    \u002F\u002F Memory should not grow linearly\n    expect(finalMemory).toBeLessThan(THRESHOLD_MB);\n\n    \u002F\u002F Check for linear growth pattern (indicates leak)\n    const isLinearGrowth = checkLinearGrowth(memorySnapshots);\n    expect(isLinearGrowth).toBe(false);\n  });\n\n  it('should handle large image lists without OOM', async () => {\n    await navigateToScreen('image-gallery');\n\n    \u002F\u002F Scroll through 100 images\n    for (let i = 0; i \u003C 20; i++) {\n      await scrollDown();\n      await sleep(500);\n    }\n\n    const memory = await getAppMemory(APP_PACKAGE);\n    expect(memory).toBeLessThan(THRESHOLD_MB);\n\n    \u002F\u002F Check for OOM crashes\n    const crashes = await getRecentCrashes(APP_PACKAGE);\n    expect(crashes.filter((c: string) => c.includes('OutOfMemoryError'))).toHaveLength(0);\n  });\n});\n\nasync function getAppMemory(packageName: string): Promise\u003Cnumber> {\n  const output = await execAdb(`shell dumpsys meminfo ${packageName}`);\n  const match = output.match(\u002FTOTAL\\s+(\\d+)\u002F);\n  return match ? parseInt(match[1], 10) \u002F 1024 : 0; \u002F\u002F Convert KB to MB\n}\n\nfunction checkLinearGrowth(snapshots: number[]): boolean {\n  if (snapshots.length \u003C 5) return false;\n  const diffs = snapshots.slice(1).map((v, i) => v - snapshots[i]);\n  const avgDiff = diffs.reduce((a, b) => a + b, 0) \u002F diffs.length;\n  return avgDiff > 2 && diffs.every((d) => d > 0); \u002F\u002F Consistent positive growth\n}\n\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {\n  \u002F\u002F Use Appium or ADB to navigate\n}\n\nasync function scrollDown(): Promise\u003Cvoid> {\n  await execAdb('shell input swipe 500 1500 500 500 300');\n}\n\nasync function getRecentCrashes(packageName: string): Promise\u003Cstring[]> {\n  const output = await execAdb(`shell logcat -d -s AndroidRuntime:E | grep ${packageName}`);\n  return output.split('\\n').filter(Boolean);\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(`adb ${command}`, { encoding: 'utf-8' });\n}\n\nfunction sleep(ms: number): Promise\u003Cvoid> {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n```\n\n## Network Throttling Tests\n\n```typescript\n\u002F\u002F android\u002Fnetwork\u002Fslow-network.test.ts\nimport { describe, it, expect, beforeAll, afterAll } from 'vitest';\n\ndescribe('Slow Network Performance', () => {\n  const networkProfiles = {\n    '3G': { download: 750, upload: 250, latency: 100 },\n    '2G': { download: 50, upload: 25, latency: 300 },\n    'slow-wifi': { download: 2000, upload: 1000, latency: 50 },\n    'lossy': { download: 5000, upload: 2000, latency: 200 },\n  };\n\n  afterAll(async () => {\n    await disableNetworkThrottling();\n  });\n\n  it('should load main feed within 5s on 3G', async () => {\n    await setNetworkProfile(networkProfiles['3G']);\n\n    const startTime = Date.now();\n    await navigateToScreen('feed');\n    await waitForContentLoaded();\n    const loadTime = Date.now() - startTime;\n\n    console.log(`Feed load on 3G: ${loadTime}ms`);\n    expect(loadTime).toBeLessThan(5000);\n  });\n\n  it('should show loading indicator on slow connections', async () => {\n    await setNetworkProfile(networkProfiles['2G']);\n    await navigateToScreen('feed');\n\n    \u002F\u002F Check that loading indicator is shown\n    const hasLoadingIndicator = await checkElementVisible('loading-spinner');\n    expect(hasLoadingIndicator).toBe(true);\n  });\n\n  it('should gracefully handle offline mode', async () => {\n    await setAirplaneMode(true);\n    await navigateToScreen('feed');\n\n    const hasOfflineMessage = await checkElementVisible('offline-message');\n    expect(hasOfflineMessage).toBe(true);\n\n    await setAirplaneMode(false);\n  });\n\n  it('should retry failed requests on connection recovery', async () => {\n    await setAirplaneMode(true);\n    await navigateToScreen('feed');\n\n    await setAirplaneMode(false);\n    await sleep(5000);\n\n    const hasContent = await checkElementVisible('feed-content');\n    expect(hasContent).toBe(true);\n  });\n});\n\nasync function setNetworkProfile(profile: { download: number; upload: number; latency: number }): Promise\u003Cvoid> {\n  \u002F\u002F Use ADB network emulation or proxy tool\n  console.log(`Setting network: ${profile.download}kbps down, ${profile.upload}kbps up, ${profile.latency}ms latency`);\n}\n\nasync function disableNetworkThrottling(): Promise\u003Cvoid> {\n  console.log('Disabling network throttling');\n}\n\nasync function setAirplaneMode(enabled: boolean): Promise\u003Cvoid> {\n  const { execSync } = await import('child_process');\n  execSync(`adb shell settings put global airplane_mode_on ${enabled ? 1 : 0}`);\n  execSync(`adb shell am broadcast -a android.intent.action.AIRPLANE_MODE`);\n}\n\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {}\nasync function waitForContentLoaded(): Promise\u003Cvoid> { await sleep(100); }\nasync function checkElementVisible(id: string): Promise\u003Cboolean> { return true; }\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## Frame Rate Performance Testing\n\n```typescript\n\u002F\u002F android\u002Frendering\u002Fframe-rate.test.ts\nimport { describe, it, expect } from 'vitest';\n\ninterface FrameStats {\n  totalFrames: number;\n  jankFrames: number;\n  frozenFrames: number;\n  p50RenderTimeMs: number;\n  p95RenderTimeMs: number;\n  p99RenderTimeMs: number;\n  fps: number;\n}\n\ndescribe('Frame Rate Performance', () => {\n  const APP_PACKAGE = 'com.example.app';\n  const TARGET_FPS = 60;\n  const MAX_JANK_PERCENTAGE = 5;\n\n  it('should maintain 60fps during list scrolling', async () => {\n    await resetFrameStats(APP_PACKAGE);\n    await navigateToScreen('product-list');\n\n    \u002F\u002F Scroll through the list for 10 seconds\n    for (let i = 0; i \u003C 20; i++) {\n      await execAdb('shell input swipe 500 1500 500 300 200');\n      await sleep(500);\n    }\n\n    const stats = await getFrameStats(APP_PACKAGE);\n\n    console.log(`FPS: ${stats.fps}, Jank: ${stats.jankFrames}\u002F${stats.totalFrames}`);\n    console.log(`Render times: p50=${stats.p50RenderTimeMs}ms, p95=${stats.p95RenderTimeMs}ms, p99=${stats.p99RenderTimeMs}ms`);\n\n    expect(stats.fps).toBeGreaterThanOrEqual(TARGET_FPS * 0.9); \u002F\u002F Allow 10% margin\n    const jankPercentage = (stats.jankFrames \u002F stats.totalFrames) * 100;\n    expect(jankPercentage).toBeLessThan(MAX_JANK_PERCENTAGE);\n  });\n\n  it('should not have frozen frames during navigation', async () => {\n    await resetFrameStats(APP_PACKAGE);\n\n    \u002F\u002F Navigate between screens\n    const screens = ['home', 'search', 'profile', 'settings', 'home'];\n    for (const screen of screens) {\n      await navigateToScreen(screen);\n      await sleep(1000);\n    }\n\n    const stats = await getFrameStats(APP_PACKAGE);\n    expect(stats.frozenFrames).toBe(0);\n  });\n\n  it('should maintain frame rate during animations', async () => {\n    await resetFrameStats(APP_PACKAGE);\n    await navigateToScreen('animations-demo');\n\n    \u002F\u002F Trigger multiple animations\n    await execAdb('shell input tap 500 500'); \u002F\u002F Trigger animation\n    await sleep(2000);\n    await execAdb('shell input tap 500 800'); \u002F\u002F Another animation\n    await sleep(2000);\n\n    const stats = await getFrameStats(APP_PACKAGE);\n    expect(stats.p95RenderTimeMs).toBeLessThan(16.67); \u002F\u002F Must be under one frame budget\n  });\n});\n\nasync function resetFrameStats(packageName: string): Promise\u003Cvoid> {\n  await execAdb(\\`shell dumpsys gfxinfo \\${packageName} reset\\`);\n}\n\nasync function getFrameStats(packageName: string): Promise\u003CFrameStats> {\n  const output = await execAdb(\\`shell dumpsys gfxinfo \\${packageName}\\`);\n\n  const totalMatch = output.match(\u002FTotal frames rendered: (\\\\d+)\u002F);\n  const jankMatch = output.match(\u002FJanky frames: (\\\\d+)\u002F);\n  const frozenMatch = output.match(\u002FNumber Missed Vsync: (\\\\d+)\u002F);\n\n  const totalFrames = totalMatch ? parseInt(totalMatch[1], 10) : 0;\n  const jankFrames = jankMatch ? parseInt(jankMatch[1], 10) : 0;\n  const frozenFrames = frozenMatch ? parseInt(frozenMatch[1], 10) : 0;\n\n  \u002F\u002F Parse frame timing histogram\n  const renderTimes = parseFrameTimings(output);\n  renderTimes.sort((a, b) => a - b);\n\n  return {\n    totalFrames,\n    jankFrames,\n    frozenFrames,\n    p50RenderTimeMs: percentile(renderTimes, 50),\n    p95RenderTimeMs: percentile(renderTimes, 95),\n    p99RenderTimeMs: percentile(renderTimes, 99),\n    fps: totalFrames > 0 ? Math.round(totalFrames \u002F 10) : 0,\n  };\n}\n\nfunction parseFrameTimings(output: string): number[] {\n  const lines = output.split('\\\\n');\n  const timings: number[] = [];\n  let inHistogram = false;\n\n  for (const line of lines) {\n    if (line.includes('HISTOGRAM')) inHistogram = true;\n    if (inHistogram && line.match(\u002F^\\\\d\u002F)) {\n      const parts = line.trim().split(\u002F\\\\s+\u002F);\n      if (parts.length >= 2) {\n        timings.push(parseFloat(parts[0]));\n      }\n    }\n  }\n\n  return timings;\n}\n\nfunction percentile(values: number[], p: number): number {\n  if (values.length === 0) return 0;\n  const index = Math.ceil(values.length * (p \u002F 100)) - 1;\n  return values[Math.max(0, index)];\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(\\`adb \\${command}\\`, { encoding: 'utf-8' });\n}\nasync function navigateToScreen(screen: string): Promise\u003Cvoid> {}\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## Battery Consumption Testing\n\n```typescript\n\u002F\u002F android\u002Fbattery\u002Fbackground-drain.test.ts\nimport { describe, it, expect } from 'vitest';\n\ndescribe('Battery Consumption', () => {\n  const APP_PACKAGE = 'com.example.app';\n\n  it('should not drain more than 2% battery in 30 minutes of background', async () => {\n    const initialBattery = await getBatteryLevel();\n\n    \u002F\u002F Launch app and send to background\n    await execAdb(\\`shell am start -n \\${APP_PACKAGE}\u002F.MainActivity\\`);\n    await sleep(5000);\n    await execAdb('shell input keyevent KEYCODE_HOME'); \u002F\u002F Send to background\n\n    \u002F\u002F Wait 30 minutes (or simulated time)\n    await sleep(30 * 60 * 1000);\n\n    const finalBattery = await getBatteryLevel();\n    const drain = initialBattery - finalBattery;\n\n    console.log(\\`Battery drain: \\${drain}% over 30 minutes\\`);\n    expect(drain).toBeLessThanOrEqual(2);\n  });\n\n  it('should release wake locks when backgrounded', async () => {\n    await execAdb(\\`shell am start -n \\${APP_PACKAGE}\u002F.MainActivity\\`);\n    await sleep(5000);\n    await execAdb('shell input keyevent KEYCODE_HOME');\n    await sleep(10000);\n\n    const wakeLocks = await getAppWakeLocks(APP_PACKAGE);\n    expect(wakeLocks).toBe(0);\n  });\n});\n\nasync function getBatteryLevel(): Promise\u003Cnumber> {\n  const output = await execAdb('shell dumpsys battery');\n  const match = output.match(\u002Flevel: (\\\\d+)\u002F);\n  return match ? parseInt(match[1], 10) : 0;\n}\n\nasync function getAppWakeLocks(packageName: string): Promise\u003Cnumber> {\n  const output = await execAdb(\\`shell dumpsys power | grep \\${packageName}\\`);\n  return (output.match(\u002FPARTIAL_WAKE_LOCK\u002Fg) || []).length;\n}\n\nasync function execAdb(command: string): Promise\u003Cstring> {\n  const { execSync } = await import('child_process');\n  return execSync(\\`adb \\${command}\\`, { encoding: 'utf-8' });\n}\nfunction sleep(ms: number): Promise\u003Cvoid> { return new Promise((r) => setTimeout(r, ms)); }\n```\n\n## App Size Monitoring\n\n```typescript\n\u002F\u002F monitoring\u002Fapp-size.ts\nexport interface AppSizeReport {\n  totalSizeMB: number;\n  downloadSizeMB: number;\n  installSizeMB: number;\n  components: Array\u003C{\n    name: string;\n    sizeMB: number;\n    percentage: number;\n  }>;\n  thresholdStatus: 'pass' | 'warning' | 'fail';\n}\n\nexport function analyzeApkSize(apkPath: string): AppSizeReport {\n  \u002F\u002F Analyze APK\u002FAAB components\n  return {\n    totalSizeMB: 0,\n    downloadSizeMB: 0,\n    installSizeMB: 0,\n    components: [],\n    thresholdStatus: 'pass',\n  };\n}\n\nexport const APP_SIZE_THRESHOLDS = {\n  totalMB: { warning: 50, critical: 100 },\n  downloadMB: { warning: 30, critical: 60 },\n  dexFilesMB: { warning: 10, critical: 20 },\n  nativeLibsMB: { warning: 15, critical: 30 },\n  resourcesMB: { warning: 20, critical: 40 },\n};\n```\n\n## Best Practices\n\n1. **Test on real devices with representative hardware** -- Low-end and mid-range devices represent the majority of users. Do not only test on flagship phones.\n2. **Measure cold and warm start separately** -- Users experience both scenarios. Cold start matters for first impressions; warm start matters for daily usage.\n3. **Run performance tests multiple times** -- A single measurement is noisy. Run at least 10 iterations and report median and p95 values.\n4. **Test under realistic network conditions** -- Use network throttling to simulate 3G, 4G, and lossy WiFi connections.\n5. **Monitor memory across the entire user session** -- Brief memory spikes are acceptable. Continuous growth indicates leaks.\n6. **Establish baselines and track regressions** -- Store performance baselines per release and fail tests when regressions exceed thresholds.\n7. **Test with realistic data volumes** -- Empty lists and single items do not stress the app. Use hundreds of items with images and complex layouts.\n8. **Include battery impact in performance criteria** -- An app that drains 10% battery per hour will get uninstalled regardless of feature quality.\n9. **Automate performance tests in CI** -- Run performance tests on every release branch, not just manually before launch.\n10. **Profile before optimizing** -- Use Android Profiler and Xcode Instruments to identify actual bottlenecks instead of guessing.\n\n## Anti-Patterns\n\n1. **Only testing on emulators** -- Emulator performance does not represent real device behavior. GPU rendering, memory management, and CPU throttling differ significantly.\n2. **Measuring performance once** -- Single measurements are unreliable due to JIT compilation, background processes, and thermal throttling. Always aggregate multiple runs.\n3. **Ignoring low-end devices** -- Most users do not have flagship phones. Test on devices with 2-3GB RAM and mid-range processors.\n4. **Not testing offline scenarios** -- Users frequently lose connectivity. Apps that crash or hang without network are unusable.\n5. **Skipping scroll performance testing** -- Janky scrolling is the most user-visible performance issue. Always measure frame rates during scroll.\n6. **Testing only on WiFi** -- WiFi performance masks network-dependent bottlenecks. Always include 3G and 4G testing.\n7. **Not monitoring memory during long sessions** -- Memory leaks may not appear in 30-second tests. Simulate 5-10 minute user sessions.\n8. **Ignoring app size** -- Large APK\u002FIPA files increase download time, storage usage, and initial launch time. Monitor and set size budgets.\n9. **Not testing background behavior** -- Apps that consume CPU and network in the background drain battery and may be killed by the OS.\n10. **Comparing performance across different device models** -- Always compare same-device measurements across versions, not different devices in the same run.\n",{"name":5,"tags":24,"agents":35,"author":48,"domains":49,"license":15,"version":54,"languages":55,"frameworks":60,"description":7,"testingTypes":62},[25,26,27,28,29,30,31,32,33,34],"mobile-performance","app-launch-time","frame-rendering","memory-profiling","battery-testing","network-throttling","appium","espresso","xctest","crash-analytics",[36,37,38,39,40,41,42,43,44,45,46,47],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","gemini-cli","amp","thetestingacademy",[50,51,52,53],"mobile","performance","ios","android","1.0.0",[56,57,58,59],"typescript","javascript","kotlin","swift",[31,32,33,61],"detox",[51,50,63,64],"e2e","integration","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fmobile-performance-testing","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":74,"prompt":84,"zipAvailable":85},[75,78,81],{"tool":76,"command":77},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Mobile Performance Testing\"",{"tool":79,"command":80},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Mobile Performance Testing\"",{"tool":82,"command":83},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Mobile Performance Testing\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fmobile-performance-testing\u002FSKILL.md",true,[],[88,96,103,110,117,124],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":92,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]