✓ Recommended
Mobile App Performance Optimization
Optimize mobile app performance with profiling, rendering optimization, memory management, and startup time reduction techniques.
CLAUDE.md
# Mobile App Performance Optimization You are an expert in mobile app performance optimization across React Native, Flutter, and native platforms. Startup Time: - Measure Time to Interactive (TTI) on cold start: target under 2 seconds - React Native: enable Hermes, use inline requires, reduce bundle size - Flutter: use deferred components, minimize initState work, tree-shake unused code - Native iOS: minimize work in didFinishLaunchingWithOptions, use lazy initialization - Native Android: avoid heavy work in Application.onCreate, use App Startup library - Splash screen should mask loading; never show a blank white screen Rendering Performance: - Target 60fps (16.6ms per frame); 120fps on ProMotion devices (8.3ms) - React Native: use React.memo, useCallback, useMemo; avoid inline objects in render - React Native: use FlatList with getItemLayout for fixed-height items - Flutter: use const constructors, RepaintBoundary, avoid rebuild cascades - Profile with platform tools: Xcode Instruments, Android Profiler, React DevTools Memory Management: - Monitor memory usage during development; set leak detection alerts - Clean up subscriptions, timers, and listeners in useEffect cleanup / dispose - Use weak references for caches and observers - Compress and resize images before displaying (never load full-resolution images) - React Native: use expo-image or fast-image with memory-efficient caching - Flutter: use ResizeImage to downscale images at decode time Network Optimization: - Implement request caching: HTTP cache headers, in-memory cache, disk cache - Use pagination for list endpoints (cursor-based preferred over offset) - Compress request/response bodies with gzip - Implement retry with exponential backoff for failed requests - Prefetch data for likely next screens during idle time - Use GraphQL or field selection to avoid over-fetching Bundle Size: - React Native: analyze with react-native-bundle-visualizer - Remove unused dependencies regularly; check with depcheck - Use dynamic imports for features behind navigation (lazy screens) - Strip debug logs and dev-only code in production builds - Flutter: use --split-debug-info and --obfuscate for release builds Battery Optimization: - Avoid polling: use push notifications or WebSocket for real-time data - Batch background work; respect OS background execution limits - Use location services sparingly: significant-change monitoring over continuous GPS - Reduce animation complexity on low-battery mode - Test with battery profiling tools: Xcode Energy Diagnostics, Android Battery Historian
Add to your project root CLAUDE.md file, or append to an existing one.