{"slug":"mobile-performance-fix","title":"mobile-performance-fix","summary":"Use when a Kotlin Multiplatform (Android + iOS) app is slow, laggy or janky, drops frames, starts slowly, keeps a loader spinning after a tap, freezes (iOS hang, watchdog 0x8badf00d, an ANR traced to shared code), grows in memory or is killed for it (jetsam, OutOfMemoryError, And","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-12-03T17:29:54.068624Z","repo":{"url":"https://github.com/Kushpawan/kmp-mobile-skills","stars":17,"forks":2,"license":"Apache-2.0","updatedAt":"2026-12-03T13:18:24Z"},"bodyHtml":"<hr>\n<h2>name: mobile-performance-fix\ndescription: Use when a Kotlin Multiplatform (Android + iOS) app is slow, laggy or janky, drops frames, starts slowly, keeps a loader spinning after a tap, freezes (iOS hang, watchdog 0x8badf00d, an ANR traced to shared code), grows in memory or is killed for it (jetsam, OutOfMemoryError, Android 17 memory limiter), leaks objects between Kotlin and Swift, drains battery or holds wake locks, or ships an oversized APK or framework — including Compose Multiplatform and SwiftUI screens over shared code. Not for Android-only Compose jank (jetpack-compose-performance) or Android-only ANRs (anr-audit-and-fix).\nlicense: Apache-2.0\ncompatibility: Kotlin Multiplatform app with Android and iOS targets. Android measurement needs adb and Android Studio, the Android CLI or Perfetto; iOS measurement needs macOS with Xcode and Instruments and, for real numbers, a physical device.\nmetadata:\ncategory: performance\nplatforms: android, ios</h2>\n<h1>Mobile performance fix — measure, fix, prove</h1>\n<p>Evidence first. Never change code on a hunch, and never report a fix without a before and an after\nnumber measured the same way. If you cannot measure it, say so instead of guessing. In apps with\noffline storage and background sync, the biggest wins are usually I/O and waiting on user-gesture\npaths, not recomposition.</p>\n<h2>When to use</h2>\n<ul>\n<li>\"Slow\", \"laggy\", \"janky\", \"stutters\", \"freezes\", \"takes forever to open\", \"spinner after I tap\nSave\", \"battery drain\", \"memory keeps growing\", \"the app gets killed in the background\".</li>\n<li>iOS hangs and watchdog terminations, and Android ANRs whose blocked call is in shared code, once\n<code>kmp-crash-triage</code> has identified the blocked thread.</li>\n<li>Memory growth, leaks or memory kills on either platform, including objects shared between Kotlin\nand Swift.</li>\n<li>APK, app bundle or iOS framework size.</li>\n</ul>\n<h2>When not to use</h2>\n<ul>\n<li>The app crashes → <code>kmp-crash-triage</code> first.</li>\n<li>Wrong results rather than slow ones → <code>mobile-bug-fix</code>.</li>\n<li>Jank in an Android-only Compose screen with no shared code involved → Google's\n<code>jetpack-compose-performance</code> skill (linked below).</li>\n<li>An Android-only ANR (main thread blocked in Android host code) → Google's <code>anr-audit-and-fix</code>.</li>\n<li>Gradle, Xcode or Kotlin/Native <strong>build</strong> speed → JetBrains <code>kotlin-tooling-native-build-performance</code>\n(linked below) or <code>kmp-build-failure-triage</code>; build-time tuning is out of scope here.</li>\n</ul>\n<h2>Rule 0 — what invalidates a measurement</h2>\n<ol>\n<li><strong>Debug builds lie.</strong> Debuggable Android builds turn off runtime optimisations and Compose does\nextra work in debug; Kotlin/Native debug binaries and Swift <code>-Onone</code> code are unoptimised.\nMeasure a release build, or a release-like variant (for example <code>staging</code> with minify on and\n<code>debuggable false</code>). Debug builds are fine for reproducing a functional bug, never for numbers.</li>\n<li><strong>The first run lies.</strong> JIT, disk caches and (on Android) profile installation warm up over the\nfirst launches. Discard the first one or two runs.</li>\n<li><strong>Instrumentation lies.</strong> An attached debugger, an in-app HTTP inspector (e.g. Chucker on\nAndroid), verbose logging, StrictMode penalties, Compose recomposition tracing, and Xcode\ndiagnostics (Zombies, Address Sanitizer) all add overhead per frame or per request. Use them to\nfind the cause, then turn them off to take the number.</li>\n<li><strong>Emulators and simulators are directional only.</strong> The iOS Simulator runs on the Mac's CPU and\nmemory; profile iOS on a device. Android emulator jank reproduces, absolute milliseconds do not.</li>\n<li><strong>One run is not a measurement.</strong> Five or more runs; report the median and the spread.</li>\n</ol>\n<h2>Step 0 — Read the project first</h2>\n<ol>\n<li><strong>Build variants.</strong> Which variants are release-like? Is R8 enabled for them? Is there a\n<code>:benchmark</code> / Macrobenchmark module or a Baseline Profile? Note the AGP version (the R8\nConfiguration Analyzer needs AGP 9.3 or later).</li>\n<li><strong>Versions.</strong> Kotlin (the Kotlin/Native GC default changed in 2.4.0), Compose Multiplatform and\nthe AndroidX Compose it maps to, Benchmark, and any <code>kotlin.native.binary.*</code> lines already in\n<code>gradle.properties</code> or <code>binaryOption(...)</code> calls in Gradle files. Read <code>gradle/libs.versions.toml</code>.</li>\n<li><strong>UI stack.</strong> Compose Multiplatform on both platforms, or SwiftUI over shared ViewModels on iOS?\nWhich state holders feed the UI, and how Swift observes them (SKIE, KMP-NativeCoroutines, a\nhand-written callback API).</li>\n<li><strong>Data and sync.</strong> Database (Room KMP, SQLDelight), the HTTP client, image loading (Coil, Kamel,\nplatform loaders), and whether writes go through a background sync queue.</li>\n<li><strong>Startup.</strong> Android <code>Application.onCreate</code>, iOS <code>App.init</code> / <code>didFinishLaunching</code>, and DI setup\n(Koin <code>createdAtStart</code>, eager singletons, database opening).</li>\n<li><strong>Instrumentation.</strong> The project's logger (Kermit, Napier or other), existing trace sections\n(<code>androidx.tracing</code>, <code>os_signpost</code>), and analytics events that already record latency — find out\nexactly what they measure.</li>\n<li><strong>Style.</strong> The project's code conventions for the fix; keep existing diagnostic log lines.</li>\n</ol>\n<h2>Workflow</h2>\n<h3>1. Fix the target</h3>\n<p>Pin down, one line each: app, screen or interaction, platform and device, build variant, and what\n\"slow\" means as a number — frames dropped while scrolling the orders list, milliseconds from tap to\nthe saved state, <code>TotalTime</code> at cold start, MB after ten minutes. Ask if the user has not said. Do\nnot profile the whole app.</p>\n<h3>2. Capture evidence and a baseline</h3>\n<table>\n<thead>\n<tr>\n<th>Symptom</th>\n<th>Android</th>\n<th>iOS</th>\n<th>Minimum evidence</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Jank, scroll stutter</td>\n<td>System trace (Studio Profiler, <code>android profiler systemtrace</code>, Android Performance Analyzer); Macrobenchmark <code>FrameTimingMetric</code></td>\n<td>Instruments: SwiftUI template (Instruments 26), Animation Hitches, Time Profiler</td>\n<td>The janky frames and the slice or stack that dominates them</td>\n</tr>\n<tr>\n<td>Slow start</td>\n<td><code>adb shell am start -W</code> (<code>TotalTime</code>); Macrobenchmark <code>StartupTimingMetric</code>, <code>ArtMetric</code></td>\n<td>Instruments App Launch; Organizer launch metrics; <code>XCTApplicationLaunchMetric</code></td>\n<td>≥5 cold starts, median + spread, plus one trace</td>\n</tr>\n<tr>\n<td>Slow gesture (tap → result)</td>\n<td>Logger timestamps at tap and at state change; then a trace</td>\n<td>Same, plus Time Profiler</td>\n<td>Local-ack latency per run; what the time is spent waiting on</td>\n</tr>\n<tr>\n<td>Freeze / ANR / hang</td>\n<td>ANR traces (see <code>kmp-crash-triage</code>)</td>\n<td>Instruments Hangs; Organizer Hangs</td>\n<td>The blocked main-thread stack</td>\n</tr>\n<tr>\n<td>Memory growth / leak</td>\n<td>Heap dumps before/after; LeakCanary task in the Studio Profiler or the LeakCanary library</td>\n<td>Allocations (generations), Leaks, Xcode Memory Graph</td>\n<td>Retained objects that grow per repetition of the flow</td>\n</tr>\n<tr>\n<td>Killed for memory</td>\n<td><code>ApplicationExitInfo</code> (low-memory kills, Android 17 memory limiter)</td>\n<td><code>JetsamEvent_…</code> logs; Organizer memory metrics</td>\n<td>Exit reason, and memory at the time</td>\n</tr>\n<tr>\n<td>Battery / wakeups</td>\n<td><code>dumpsys batterystats</code>; Play vitals excessive partial wake locks</td>\n<td>Power Profiler; Organizer energy reports</td>\n<td>The wake lock, alarm, job or timer responsible</td>\n</tr>\n<tr>\n<td>Size</td>\n<td>APK Analyzer, <code>android analyze</code>; R8 Configuration Analyzer</td>\n<td>App Thinning Size Report; framework size per architecture</td>\n<td>Size by component before/after</td>\n</tr>\n</tbody>\n</table>\n<p>Capture commands and tool details per platform: <a href=\"references/android.md\">references/android.md</a> and\n<a href=\"references/ios.md\">references/ios.md</a>.</p>\n<p>Write the baseline into the report <strong>before</strong> touching code.</p>\n<h3>3. Diagnose by layer</h3>\n<p>Work outward from the measurement, in this order.</p>\n<h4>3a. Gesture and I/O paths — check first</h4>\n<ul>\n<li><strong>Never block a user gesture on draining an entire background sync queue.</strong> A drain processes\nevery pending item (uploads, other records) with network timeouts on each, and may wait behind a\ndrain that is already running. The user's tap then waits on unrelated backlog. Instead: write\nthe record locally as <em>pending</em>, trigger the queue without awaiting the drain, and wait — with a\nshort bound — only for <strong>this</strong> record's acknowledgement.</li>\n<li><strong>Treat \"pending\" as success.</strong> If the bound expires, return the pending record. The UI shows it\nfrom the local database stream and updates when the server acknowledges it. Offline is the same\npath.</li>\n<li><strong>Do not wrap the whole drain in a timeout</strong> at the call site: cancelling it can cancel an HTTP\nrequest mid-flight. <strong>Do not post the record inline</strong> from the repository to \"make it fast\" when\nrecords depend on each other — ordering belongs to the queue.</li>\n<li><strong>Cap location fetches on gesture paths</strong> with <code>withTimeoutOrNull</code>. A platform location fix can\ntake several seconds; location attached to a record is metadata. Make any blocking decision\nthat needs location (for example a geofence check) explicitly, before the gesture's work starts.</li>\n<li><strong>Measure gesture latency as local-ack latency</strong> (tap → UI shows the saved or pending state) and\nrecord server-ack latency separately. Mixing them makes a good fix look like a regression.</li>\n<li>Waiting for the full queue is right only when that is the point (an explicit \"Sync now\", a final\nsubmit that requires everything uploaded) — and then show progress, not an unexplained spinner.</li>\n<li>Also: main-thread database or file I/O (the repository should use an injected I/O dispatcher),\n<code>runBlocking</code> on the main thread, and N sequential requests on screen entry that could run\nconcurrently with <code>async</code>.</li>\n</ul>\n<p>Worked example and tests: <a href=\"references/gesture-latency.md\">references/gesture-latency.md</a>.</p>\n<h4>3b. Data layer</h4>\n<ul>\n<li>A missing index on a filtered or sorted column; <code>SELECT *</code> into wide rows for a list.</li>\n<li>A database <code>Flow</code> that re-emits the whole list on any write to the table, feeding an expensive\nmapping — use <code>distinctUntilChanged()</code> and keep mapping cheap or off the main thread.</li>\n<li>Unbounded list fetches where the API supports paging.</li>\n<li>Large JSON parsed on the main thread; images decoded at full size — downsample to the display\nsize before decoding.</li>\n</ul>\n<h4>3c. UI</h4>\n<ul>\n<li><strong>Compose (Android, and iOS with Compose Multiplatform):</strong> use the Compose performance skills\nlinked below rather than rules from memory. Highest-yield checks: stable <code>key</code> and <code>contentType</code>\non lazy items; state reads deferred into layout/draw lambdas for scroll- or animation-driven\nvalues; no allocation or heavy work in composition; state collected with lifecycle awareness.\nOn Android, Compose 1.13 recomposition tracing records the state reads and writes behind each\nrecomposition in a Perfetto trace — use it to find <em>why</em> a screen recomposes, then turn it off\nbefore measuring. Some AndroidX Compose APIs (for example 1.13's <code>computedStateOf</code>) are not in\nCompose Multiplatform, or only in newer versions — check the CMP version in\n<code>gradle/libs.versions.toml</code> before recommending one for shared UI.</li>\n<li><strong>SwiftUI over shared state:</strong> a Kotlin state object republished on every small change can\ninvalidate large view trees. The Instruments 26 SwiftUI instrument shows which view updates ran\nand what caused them. Observe the narrowest value a view needs; see the SwiftUI performance\nskills linked below.</li>\n</ul>\n<h4>3d. Startup</h4>\n<ul>\n<li>Android <code>Application.onCreate</code> and iOS launch code: logging setup, database open, sync\nscheduling, DI graph creation. Anything not needed for the first frame moves off the launch path\nor behind first use.</li>\n<li>Eager DI singletons (Koin <code>createdAtStart = true</code>, modules that construct clients at\nregistration) cost the same on iOS — the shared graph is built in Kotlin/Native.</li>\n<li>Android: R8 on the measured variant; Baseline Profiles for startup and critical journeys.\nBenchmark 1.5 added <strong>partial</strong> Baseline Profile support for KMP library modules (the\n<code>baselineProfile</code> dependency configuration does not work in <code>androidMain</code>; use the\n<code>baselineProfile {}</code> extension). Validate a profile with <code>ArtMetric</code> (JIT and unoptimised class\nloading). Setup: <a href=\"references/android.md\">references/android.md</a> section 3.</li>\n<li>iOS: each dynamic framework adds load work at launch; a static Kotlin framework avoids one —\nmeasure before switching, since it changes linking for the whole app.</li>\n</ul>\n<h4>3e. Memory</h4>\n<p>Details, tools and code: <a href=\"references/memory.md\">references/memory.md</a>. The KMP-specific causes:</p>\n<ul>\n<li><strong>Retain cycles across Kotlin and Swift are never collected.</strong> Kotlin's GC reclaims cycles of\nKotlin objects, but a cycle that includes at least one Swift/ObjC object cannot be reclaimed. The\nusual shape: a Kotlin object stores a Swift closure that captures <code>self</code>, and <code>self</code> holds the\nKotlin object. Use <code>[weak self]</code> and an explicit cancel/close.</li>\n<li><strong>Collection started from Swift that nothing cancels</strong> keeps the collector, its closure and\neverything they capture alive, and keeps doing work. Return a cancellation handle, or use an\nintegration (SKIE, KMP-NativeCoroutines) whose Swift task cancellation reaches Kotlin.</li>\n<li><strong>Swift/ObjC objects released by Kotlin are freed only after a GC</strong>, so memory can look higher\nthan expected without being a leak; a long loop that creates interop objects may need an\n<code>autoreleasepool</code>.</li>\n<li><strong>Kotlin/Native GC:</strong> concurrent mark and sweep (CMS) is the default from Kotlin 2.4.0, which\nshortens GC pauses compared with the previous PMCS default. To see GC pauses in Instruments, set\n<code>kotlin.native.binary.enableSafepointSignposts=true</code>. Options: <a href=\"references/ios.md\">references/ios.md</a>.</li>\n<li><strong>Android 17 memory limiter:</strong> Android 17 sets per-app memory limits based on device RAM. A\nkilled session shows <code>ApplicationExitInfo</code> reason <code>REASON_OTHER</code> with <code>MemoryLimiter:AnonSwap</code>\nin the description. Treat it as a leak or outlier to fix, not as noise.</li>\n<li>Android: the usual leaks — an <code>Activity</code> or <code>View</code> held by a ViewModel, a singleton, or a\nnever-cancelled scope.</li>\n</ul>\n<h4>3f. Battery</h4>\n<ul>\n<li>Android: Play's <strong>excessive partial wake locks</strong> core vital counts a session as excessive when it\nholds more than 2 cumulative hours of non-exempt wake locks in 24 hours; the bad-behaviour\nthreshold is 5% of sessions over 28 days. Find the tag in Android vitals, then the code holding it.</li>\n<li>Usual KMP causes on both platforms: a sync that reschedules itself on every failure, a location\nrequest left running, a polling loop in a scope that outlives the screen.</li>\n<li>iOS: Power Profiler in Instruments (tethered, or recorded on the device and opened later).</li>\n</ul>\n<h4>3g. Size</h4>\n<ul>\n<li>Android: <code>android analyze</code> on the APK or bundle, and on AGP 9.3+ the R8 Configuration Analyzer\n(<code>./gradlew :&lt;module&gt;:analyze&lt;Variant&gt;R8Config</code>) to rank costly keep rules. Use Google's\n<code>r8-analyzer</code> skill for the rules themselves.</li>\n<li>iOS: export only the API Swift calls (<code>export(...)</code> disables dead-code elimination for that\ndependency); <code>smallBinary</code> is an experimental Kotlin/Native option — measure before keeping it.</li>\n</ul>\n<h3>4. Fix</h3>\n<ul>\n<li>One cause per change, at the smallest responsible layer. No drive-by refactors.</li>\n<li>Follow the project's style. Keep existing diagnostic log lines; never add <code>println</code> / <code>Log.d</code> /\n<code>NSLog</code>.</li>\n<li>If the fix changes a published library, say so: consumers see it only after a new version is\npublished or they build against the local copy.</li>\n</ul>\n<h3>5. Prove it</h3>\n<p>Re-run the <strong>same</strong> measurement: same device, build variant, iterations and data.</p>\n<pre><code>Symptom      &lt;what the user saw&gt;\nMeasured     &lt;metric&gt; = &lt;before&gt; (median of n=&lt;runs&gt;, &lt;device&gt;, &lt;variant&gt;)\nCause        &lt;one sentence, with the trace slice, stack or code path that proves it&gt;\nFix          &lt;file:line&gt; — &lt;what changed&gt;\nResult       &lt;metric&gt; = &lt;after&gt; (same conditions)  -&gt;  &lt;delta&gt;\nNot fixed    &lt;anything still slow, with its number&gt;\n</code></pre>\n<p>A fix with no after-number is not done. <strong>If the change did not move the number, say so and revert\nit</strong> rather than keeping speculative churn. Then run the affected module's tests on both platforms.</p>\n<h2>Quick reference</h2>\n<table>\n<thead>\n<tr>\n<th>Symptom</th>\n<th>First suspect</th>\n<th>Evidence to get</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Spinner after tap that grows with offline backlog</td>\n<td>Gesture awaits a full sync-queue drain</td>\n<td>Logger timestamps around the await; queue length</td>\n</tr>\n<tr>\n<td>Spinner after tap, worse indoors</td>\n<td>Uncapped location fetch on the gesture path</td>\n<td>Time spent in the location call</td>\n</tr>\n<tr>\n<td>Janky list scroll</td>\n<td>Unstable or missing keys, heavy item composition, image decode size</td>\n<td>System trace / Time Profiler over the scroll</td>\n</tr>\n<tr>\n<td>Screen recomposes on every scroll pixel (Android)</td>\n<td>State read too high in the tree</td>\n<td>Compose 1.13 recomposition tracing</td>\n</tr>\n<tr>\n<td>Slow cold start on both platforms</td>\n<td>Eager DI graph, database open, network on launch</td>\n<td>Startup trace; time per init step</td>\n</tr>\n<tr>\n<td>Freeze when opening a screen</td>\n<td>Main-thread I/O or <code>runBlocking</code></td>\n<td>Main-thread stack during the freeze</td>\n</tr>\n<tr>\n<td>iOS memory grows per visit to a screen</td>\n<td>Kotlin↔Swift retain cycle or uncancelled collection</td>\n<td>Allocations generations; Memory Graph</td>\n</tr>\n<tr>\n<td>iOS hitches every few seconds, no busy main thread</td>\n<td>Kotlin/Native GC pauses</td>\n<td><code>enableSafepointSignposts</code> + os_signpost</td>\n</tr>\n<tr>\n<td>Android memory grows per visit</td>\n<td>Leaked <code>Activity</code>/<code>View</code>/ViewModel</td>\n<td>LeakCanary trace or heap dump diff</td>\n</tr>\n<tr>\n<td>Android 17 sessions killed, no crash</td>\n<td>Memory limiter</td>\n<td><code>ApplicationExitInfo</code> with <code>MemoryLimiter:AnonSwap</code></td>\n</tr>\n<tr>\n<td>Killed in background (iOS)</td>\n<td>High memory at suspension</td>\n<td><code>JetsamEvent</code> logs; Allocations</td>\n</tr>\n<tr>\n<td>Play vitals battery warning</td>\n<td>Long-held partial wake lock</td>\n<td>Wake lock tags with P90/P99 duration in vitals</td>\n</tr>\n</tbody>\n</table>\n<h2>Verify</h2>\n<p>Report each check as <strong>PASS</strong>, <strong>FAIL</strong> or <strong>NOT RUN (reason)</strong>, and each measurement with its numbers.\nNever report a check as passed that you did not run.</p>\n<pre><code>./gradlew :composeApp:assembleRelease                 # or the release-like variant from Step 0\nadb shell am force-stop com.example.app &amp;&amp; adb shell am start -W -n com.example.app/.MainActivity\n./gradlew :benchmark:tasks --all | grep -i connected  # Macrobenchmark task name, if the module exists\n./gradlew :composeApp:analyzeReleaseR8Config          # size work, AGP 9.3 or later only\nadb shell am memory-limiter status                    # Android 17 devices that impose limits\nxcrun xctrace record --template 'Time Profiler' --device '&lt;device name or UDID&gt;' \\\n  --attach '&lt;app process name&gt;' --time-limit 20s --output before.trace\n./gradlew :shared:allTests                            # behaviour unchanged on every target\n./gradlew :shared:iosSimulatorArm64Test               # macOS only\n</code></pre>\n<p>Name the measurement commands you actually ran in the report, with device and variant. A number\nfrom a debug build, an emulator, a simulator or a build with recomposition tracing on is reported\nas directional, not as a result.</p>\n<h2>Common mistakes</h2>\n<table>\n<thead>\n<tr>\n<th>Mistake</th>\n<th>Why it bites</th>\n<th>Fix</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Measuring a debug build</td>\n<td>Debug costs dominate and hide the real bottleneck</td>\n<td>Release or release-like variant</td>\n</tr>\n<tr>\n<td>Optimising recomposition first</td>\n<td>Most user-visible waits are I/O on the gesture path</td>\n<td>Check gesture and I/O paths first (3a)</td>\n</tr>\n<tr>\n<td>Awaiting the whole sync queue from a button</td>\n<td>Latency scales with unrelated backlog and network timeouts</td>\n<td>Trigger the queue, bounded wait on the caller's own record</td>\n</tr>\n<tr>\n<td><code>withTimeoutOrNull</code> around the full drain</td>\n<td>Cancels in-flight requests mid-upload</td>\n<td>Bound only the wait for the caller's record</td>\n</tr>\n<tr>\n<td>Reporting server-ack time as tap latency</td>\n<td>A correct fix looks like no change</td>\n<td>Record local-ack and server-ack separately</td>\n</tr>\n<tr>\n<td>Measuring with recomposition tracing on</td>\n<td>Tracing adds overhead to every state read and write</td>\n<td>Use it to find the cause; measure with it off</td>\n</tr>\n<tr>\n<td>Calling <code>androidx.tracing</code> from <code>commonMain</code> shared with iOS</td>\n<td>Google Maven publishes Android and JVM artifacts only, so the iOS build fails</td>\n<td>Trace from <code>androidMain</code> or an Android/JVM module; use <code>os_signpost</code> on iOS</td>\n</tr>\n<tr>\n<td>Running <code>android profiler leakcanary</code></td>\n<td>Not in the Android CLI help as of Dec 2026</td>\n<td>LeakCanary task in the Studio Profiler, or <code>android profiler heapdump</code></td>\n</tr>\n<tr>\n<td>Building new monitoring on MetricKit APIs Apple marked for deprecation</td>\n<td>MetricKit is being rebuilt; old APIs will go</td>\n<td>Check Apple's current MetricKit docs before adding code</td>\n</tr>\n<tr>\n<td>Profiling iOS on the Simulator</td>\n<td>Mac CPU and memory are not a phone's</td>\n<td>Profile on a device</td>\n</tr>\n<tr>\n<td>Keeping a change that did not move the number</td>\n<td>Adds risk and churn with no benefit</td>\n<td>Revert it and report \"no gain\"</td>\n</tr>\n<tr>\n<td><code>[self]</code> captured in a closure stored by Kotlin</td>\n<td>Cross-runtime cycle, never collected</td>\n<td><code>[weak self]</code> plus an explicit cancel</td>\n</tr>\n</tbody>\n</table>\n<h2>Related skills</h2>\n<ul>\n<li><code>kmp-crash-triage</code> — ANRs, hangs, watchdog kills and memory kills start there.</li>\n<li><code>mobile-bug-fix</code> — behaviour bugs found while profiling.</li>\n<li><code>mobile-platform-parity</code> — when one platform is slow and the other is not because behaviour differs.</li>\n<li><a href=\"https://github.com/android/skills/tree/main/profilers/android-profiler\">android/skills <code>profilers/android-profiler</code></a> — recording and analysing Android traces, heap dumps, wake locks and PerfettoSQL.</li>\n<li><a href=\"https://github.com/android/skills/tree/main/jetpack-compose/jetpack-compose-performance\">android/skills <code>jetpack-compose/jetpack-compose-performance</code></a> — Compose stability, lazy layouts, phase deferral; Android-only Compose jank.</li>\n<li><a href=\"https://github.com/android/skills/tree/main/performance/anr-audit-and-fix\">android/skills <code>performance/anr-audit-and-fix</code></a> — Android ANR audit and trace triage.</li>\n<li><a href=\"https://github.com/android/skills/tree/main/performance/r8-analyzer\">android/skills <code>performance/r8-analyzer</code></a> — keep-rule cost and the R8 Configuration Analyzer.</li>\n<li><a href=\"https://github.com/android/skills/tree/main/devtools/android-cli\">android/skills <code>devtools/android-cli</code></a> — <code>android profiler</code>, <code>android analyze</code> and <code>android signals</code>.</li>\n<li><a href=\"https://github.com/Kotlin/kotlin-agent-skills/tree/main/skills/kotlin-tooling-native-build-performance\">Kotlin/kotlin-agent-skills <code>kotlin-tooling-native-build-performance</code></a> — slow Kotlin/Native compile and link (build speed, not app speed).</li>\n<li><a href=\"https://github.com/skydoves/compose-performance-skills\">skydoves/compose-performance-skills</a> — <code>measurement/testing-compose-in-release-mode</code>, <code>measurement/generating-baseline-profiles</code>, <code>audit/auditing-compose-performance</code>, <code>lists/optimizing-lazy-layouts</code>.</li>\n<li><a href=\"https://github.com/Dimillian/Skills/tree/main/swiftui-performance-audit\">Dimillian/Skills <code>swiftui-performance-audit</code></a> and <a href=\"https://github.com/CharlesWiltgen/Axiom\">CharlesWiltgen/Axiom</a> (<code>axiom-profile-performance</code>, <code>axiom-audit-memory</code>) — the SwiftUI and Instruments side.</li>\n<li><a href=\"https://developer.android.com/topic/performance/baselineprofiles/overview\">Baseline Profiles overview</a>, <a href=\"https://kotlinlang.org/docs/native-binary-options.html\">Kotlin/Native binary options</a> and <a href=\"https://kotlinlang.org/docs/native-arc-integration.html\">Kotlin/Native and Swift/ObjC ARC integration</a>.</li>\n</ul>\n","files":[{"path":"references/android.md","sizeBytes":10400,"isText":true},{"path":"references/gesture-latency.md","sizeBytes":7647,"isText":true},{"path":"references/ios.md","sizeBytes":8102,"isText":true},{"path":"references/memory.md","sizeBytes":7527,"isText":true},{"path":"SKILL.md","sizeBytes":22574,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-12-03T17:30:40.692038Z","sha256":"5C572427A91D1178B942A71FC2DDE25A39B21D540CEA161AB5D5CD80CBCCE002","sizeBytes":24274},"review":null,"source":{"repositoryUrl":"https://github.com/Kushpawan/kmp-mobile-skills","path":"skills/mobile-performance-fix","license":"Apache-2.0","commit":"c04c11f696aa7a0f3c67761e5e48a7fd8201efa9","subtreeSha":"6ADCFBA5266E372A0A1EA4E14F5A3719AE2EDC63190F508003F7068F0DD32B24","lastSyncedAt":"2026-12-03T17:29:47.313948Z"},"reviewedAt":"2026-12-03T17:32:15.202206Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Kushpawan/kmp-mobile-skills/tree/main/skills/mobile-performance-fix"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kushpawan-kmp-mobile-skills@llmmart"},{"target":"git","command":"git clone https://github.com/Kushpawan/kmp-mobile-skills.git"}]}