Home / Market / jetpack compose performance

jetpack compose performance

Diagnose and optimize Android Jetpack Compose UI code. Use this skill when analyzing performance bottlenecks of existing code to minimize recomposition overhead and prevent dropped frames and UI lag.

skill★ 108441713 dlskills.shApache-2.0Install in CosmosUpstream Source

Documentation & Preview

--- name: jetpack-compose-performance description: Diagnose and optimize Android Jetpack Compose UI code. Use this skill when analyzing performance bottlenecks of existing code to minimize recomposition overhead and prevent dropped frames and UI lag. license: Complete terms in LICENSE.txt metadata: author: Google LLC last-updated: '2026-10-14' keywords:

---

Foundational prerequisites

Before micro-optimizing composables, ensure standard production flags are in place:

  1. Release Build: Never profile or benchmark debuggable builds; ART runtime verification severely degrades performance.
  2. R8 Minification: Keep R8 enabled to optimize bytecode and coroutine dispatch.
  3. Baseline Profiles: Generate baseline profiles for critical user journeys (cold start, key scrolling feeds) so the ART VM pre-compiles and preloads classes ahead of time.

Optimization audit workflow

  1. Exhaustive Scan : Scan the target code against all 7 core categories in the following sections. Evaluate every @Composable function, modifier chain, and lazy-layout data model against all checklist rules rather than stopping after the first issue found.
  2. Mandatory Reference Read Before Flagging or Editing : Whenever a file matches a rule in Categories 1--7, you MUST open and read the corresponding references/*.md file for the approved fix pattern and full scope guards before reporting a finding or editing code. Never rely on the summary bullets alone to write fixes.

1. State, snapshots, and stability (references/state-and-stability.md)

MANDATORY : Before flagging or fixing any issue in this category, you

MUST read references/state-and-stability.md.

Write). Prevent backwards writes across phases to avoid first-frame popping, jank, and infinite recomposition loops (Backwards Write). Do not flag a state assignment at the start of a composable (Write -> Read or Composition Write -> Draw Read`) as a backwards write---a backwards write strictly requires a read of that state to precede the write.

viewModel.getPath()). While not a backwards write, this adds unnecessary slot table and MutableState snapshot overhead (and risks becoming a backwards write if a read is later added preceding the assignment); use a plain local val or read the value directly inside the target phase (such as Modifier.drawWithCache`).

{ ... } } (or computedStateOf` on Compose 1.13+).

Models : When writing or optimizing code, never add @Immutable or @Stable to models containing collections (List, Set, Map), and never** recommend replacing kotlin.collections.List<T> with ImmutableList<T> (or adding ImmutableList to stability_config.txt). Calling O(N) .equals() on collections on every recomposition pass is more expensive than O(1) instance equality (===) under Strong Skipping Mode.

(Large Lazy Datasets Only)** :

collection hierarchy** (e.g., feed streams, large lists of tags/items, or multi-level nested lists like Post with List<Paragraph> and List<Markup>), where recursive O(N) .equals() checks degrade scrolling and recomposition performance.

annotations untouched and do not flag them** . Never blindly grep and flag all @Stable/@Immutable classes across a codebase without verifying they feed a lazy layout with a large dataset.

2. Layouts and measurement optimization (references/layouts.md)

MANDATORY : Before flagging or fixing any issue in this category, you

MUST read references/layouts.md.

3. Lazy layouts optimization (references/lazy-layouts.md)

MANDATORY : Before flagging or fixing any issue in this category, you

MUST read references/lazy-layouts.md.