compose-recomposition-performance

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Compose recomposition performance

Jetpack Compose重组性能

Router only — deep fixes live in
compose-stability-diagnostics
and
compose-state-deferred-reads
.
仅作路由指引——深度修复方案请查看
compose-stability-diagnostics
compose-state-deferred-reads

Two axes

两大排查维度

  1. Parameter stability / skipping — can Compose skip this restartable composable; are arguments stable and comparable?
  2. Where
    State
    is read
    — is frame-rate
    State
    read during composition vs layout/draw?
Either axis can dominate; they combine independently.
  1. 参数稳定性/可跳过性 — Compose能否跳过该可重启的composable?参数是否稳定且可比较?
  2. State读取阶段 — 帧率相关的State是在重组阶段读取,还是在布局/绘制阶段读取?
任一维度都可能是主要问题,二者相互独立且共同影响性能。

Route here → focused skill

路由指引 → 针对性技能

Primary suspicionNext skill
Skipping, unstable params, compiler/
composables.txt
churn
compose-stability-diagnostics
Frame-rate
State
read phase (composition vs layout/draw)
compose-state-deferred-reads
Evidence for bothApply both skills in parallel
主要怀疑方向下一步技能
可跳过性问题、参数不稳定、编译器/
composables.txt
频繁变动
compose-stability-diagnostics
帧率State读取阶段(重组 vs 布局/绘制)
compose-state-deferred-reads
两者均有迹象同时应用两项技能

Review order

排查步骤

  1. Decide which axis fits the evidence; open the matching skill.
  2. If unclear, sample both — stability churn vs composition-phase reads of fast
    State
    .
  3. Re-measure after changes.
  1. 根据现有迹象确定对应的排查维度,打开匹配的技能文档。
  2. 若无法确定,则同时排查两者——参数稳定性频繁变动与快速State在重组阶段的读取问题。
  3. 修改后重新测量性能。

When NOT to apply

不适用于以下场景

  • Recomposition tracks real data changes, or the bug is correctness not cost.
  • No profiler / compiler signal suggests a problem.
  • 重组是真实数据变化导致的,或者问题属于正确性而非性能开销问题。
  • 没有性能分析器或编译器信号表明存在问题。