compose-modifier-system

Installation
SKILL.md

Performance First

Every Compose frame runs three phases. Cost rises left-to-right; restart scope shrinks left-to-right.

Phase What Runs Restart Cost Trigger
Composition Composable functions, state reads HIGH (whole scope) State read in composable body
Layout Measure + place MEDIUM (subtree) State read in measure lambda
Drawing Canvas commands, graphicsLayer LOW (single node) State read in draw/graphicsLayer lambda

Defer State Reads (decision tree)

Do you need the value during composition?

  • YES → read as T (Composition phase) — accept full restart cost
  • NO → can you defer to layout/draw?
    • Layout-only? → pass () -> T into Modifier.layout/offset { } lambda
    • Draw/transform? → pass () -> T into Modifier.graphicsLayer { } / drawBehind { } lambda

Rule: prefer Modifier.offset { lambda } over Modifier.offset(state.value.dp). Lambda variant defers the read to the layout phase, skipping recomposition entirely.

Installs
4
GitHub Stars
1
First Seen
Aug 25, 2026
compose-modifier-system — santimattius/performance-compose-skills