安定したパラメータと不安定なパラメータ
Composableをスキップ可能にする要素を理解します。
「安定したパラメータと不安定なパラメータ」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
What Skipping Means
When a Composable re-runs but its inputs have not changed, Compose can skip it entirely. Skipping is how fast Compose apps stay fast. 🚀
Stability Decides Skipping
Compose only skips a Composable when every parameter is stable. One unstable input and the whole function re-executes on each recomposition.
What "Stable" Promises
A type is stable when Compose trusts that equals() is reliable and that public properties will not change without telling Compose.
Naturally Stable Types
Primitives, String, and function types are stable out of the box, so passing an Int or a lambda never blocks skipping.
fun Greeting(name: String, count: Int) {
Text("Hello $name x$count")
}val Properties Are Stable
A class with only val properties of stable types is itself stable. Immutable data is the friendliest input you can give Compose.
data class User(val id: Int, val name: String)var Makes a Type Unstable
A mutable var property can change behind Compose's back, so the class becomes unstable and its Composable can no longer skip.
data class Counter(var value: Int)Collections Look Unstable
Plain List, Map, and Set are treated as unstable, because the interface could hide a mutable ArrayList underneath.
fun ItemRow(items: List<String>) { }Why Interfaces Worry Compose
An interface parameter is unstable: the concrete implementation is unknown at compile time, so Compose cannot guarantee its equals() behaves.
Strong Skipping Mode
Newer Compose ships strong skipping, which lets unstable parameters compare by reference, so many cases skip without extra annotations.
Spotting Unstable Inputs
If a Composable redraws every frame for no visible reason, suspect an unstable parameter forcing a full re-run each time.
Stability Is About Trust
Stability is a promise to Compose, not magic. The more immutable your inputs are, the more work Compose is free to skip.
Quick Check
Test your grasp of stability.
Recap: Stable Wins
Compose skips a Composable only when every input is stable. Favor primitives, Strings, and val-only classes to keep redraws cheap. ✅
よくある質問
「安定したパラメータと不安定なパラメータ」レッスンは無料ですか?
はい。「安定したパラメータと不安定なパラメータ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。
「安定したパラメータと不安定なパラメータ」で何を学びますか?
Composableをスキップ可能にする要素を理解します。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Jetpack Compose Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「安定したパラメータと不安定なパラメータ」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このJetpack Compose Academyレッスンでコードを書いて実行できますか?
はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 安定したパラメータと不安定なパラメータ
- スキップ、@Stable、@Immutable
- 状態の読み取りを遅延させる
- Layout Inspectorと再コンポジション回数