jetpack-compose-performance
यह क्या करती है
यह स्किल Jetpack Compose स्क्रीन कोड में प्रदर्शन समस्याएँ जाँचती है, जैसे ज़्यादा री-ड्रॉ और छूटे फ़्रेम। यह उन Android डेवलपरों के लिए है जिनका ऐप स्क्रॉल करते या स्क्रीन खोलते समय अटकता है।
कब इस्तेमाल करें
- ✓जब कोई Android Compose स्क्रीन स्क्रॉल करते समय अटके या फ़्रेम छोड़े।
- ✓जब आप अपनी Compose स्क्रीन में बेवजह होने वाले री-ड्रॉ कम करना चाहते हैं।
- ✓जब आप ऐप के शुरू होने की गति बढ़ाने के लिए release build सेटिंग और baseline profiles सेट करना चाहते हैं।
Skill का लिंक
https://github.com/android/skills/blob/main/jetpack-compose/jetpack-compose-performance/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरा Compose फ़ीड स्क्रॉल करते समय अटकता है। प्रदर्शन की समस्याएँ ढूँढिए और उन्हें ठीक कीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल पहले जाँचती है कि build में release सेटिंग है, क्योंकि debug build माप के लिए धीमा होता है। फिर वह हर composable और लिस्ट को एक चेकलिस्ट से जाँचती है और सुधार सुझाने से पहले संदर्भ नोट्स पढ़ती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Foundational prerequisites
Before micro-optimizing composables, ensure standard production flags are in place:
- Release Build: Never profile or benchmark debuggable builds; ART runtime verification severely degrades performance.
- R8 Minification: Keep R8 enabled to optimize bytecode and coroutine dispatch.
- 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
- Exhaustive Scan : Scan the target code against all 7 core categories in the following sections. Evaluate every
@Composablefunction, modifier chain, and lazy-layout data model against all checklist rules rather than stopping after the first issue found. - 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/*.mdfile 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.
- Phase Deferral (Lambdas) : Wrap frequently changing state reads in lambdas (such as
Modifier.offsetorModifier.graphicsLayer) so reads occur in Layout or Draw phase rather than Composition. - Prohibit Backwards Writes (Verify Read-Before-Write Order) : Never modify state in a later phase or after it has already been read in the same composition pass (
Read -> Write, orComposition Read -> Layout or Draw 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 -> ReadorComposition Write -> Draw Read) as a backwards write---a backwards write strictly requires a read of that state to precede the write. - Avoid Redundant State Wrapping in Composition (
Write -> Read) : Do not wrap synchronous values inremember { mutableStateOf(...) }only to overwrite them immediately at the top of composition before reading them (for example,var path by remember { mutableStateOf(Path()) }; path = viewModel.getPath()). While not a backwards write, this adds unnecessary slot table andMutableStatesnapshot overhead (and risks becoming a backwards write if a read is later added preceding the assignment); use a plain localvalor read the value directly inside the target phase (such asModifier.drawWithCache). - Explicit
rememberKeys & Slot Overhead : Always pass all input variables and composable parameters referenced insiderememberas calculation keys. Remember thatrememberstoreskeys + 1objects in the slot table and checks key equality on every recomposition; onlyrememberwhen allocations are heavy or identity must be preserved. Do not pass snapshot state values/properties (e.g.state.value) as keys when wrappingderivedStateOf(passing theStateinstance itself is fine if the instance reference can change). computedStateOfvsderivedStateOf(Compose 1.13+) : On Compose 1.13+, usecomputedStateOffor simple condition checks and filtered state from fast-changing inputs (such asscrollState.value > 0), which provides significantly faster invalidation thanderivedStateOf(on Compose< 1.13, useremember { derivedStateOf { ... } }). ReservederivedStateOffor heavy calculations that benefit from multi-read caching, or trivial calculations read frequently enough per composition (roughly10 / numberOfStatesReadPerCalculationtimes without invalidating between reads) to make up for the invalidation cost.- Synchronous State Derivation : Audit for asynchronous
produceState+snapshotFlowblocks observing Compose states (such as scroll positions or collection sizes); replace them with synchronousremember { derivedStateOf { ... } }(orcomputedStateOfon Compose 1.13+). - Trivial Primitives : Prefer plain custom Kotlin getters (
get()) overderivedStateOforcomputedStateOffor simple boolean expressions and property lookups.
अक्सर पूछे जाने वाले सवाल
क्या मुझे debug build में प्रदर्शन मापना चाहिए?
नहीं। स्किल कहती है कि debug build असली इस्तेमाल से धीमे चलते हैं, इसलिए release build में मापें।
baseline profile क्या है?
यह एक फ़ाइल है जो Android को बताती है कि कौन सा कोड पहले से तैयार करना है, ताकि शुरुआत और स्क्रॉलिंग जैसे मुख्य काम तेज़ चलें।
क्या यह पूरी स्क्रीन दोबारा लिखती है?
यह अपनी चेकलिस्ट के अनुसार खास समस्याएँ ढूँढती है और हर मिली समस्या के लिए लक्षित सुधार सुझाती है।
जानकारी
लेखक का मूल विवरण
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.
repo: android/skills
लोकप्रियता
- GitHub स्टार
- 10k
- रैंकिंग में स्थान
- #11921
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 29/10/2026
कमेंट
- …
इस repository की और skills
agp-9-upgrade
10kआपके एजेंट को Android ऐप को Android Gradle Plugin 9 पर ले जाने और उसके breaking changes सुधारने में मदद करती है। मल्टीप्लेटफ़ॉर्म प्रोजेक्ट के लिए नहीं।
camerax
10kआपके एजेंट को CameraX से Android कैमरा फ़ीचर बनाने में मदद करती है, जिसमें वीडियो रिकॉर्डिंग, हार्डवेयर कंट्रोल, ML Kit और Media3 इफ़ेक्ट शामिल हैं।
android-for-cars-parked-apps
10kआपके एजेंट को Android वीडियो, गेम या ब्राउज़र ऐप को Android Auto और Android Automotive पर parked ऐप के रूप में चलाने के लिए ढालने में मदद करती है।
appfunctions
10kआपके एजेंट को Android ऐप के मुख्य काम ढूँढकर उन्हें AppFunctions के रूप में देने में मदद करती है, ताकि AI एजेंट और वॉइस कमांड उन्हें चला सकें।
मिलती-जुलती skills
android-clean-architecture
280kयह आपके एजेंट को Android projects को व्यवस्थित तरीके से संभालने देता है। यह code को ऐसा ढांचा देता है कि उसकी देखभाल और नए features जोड़ना आसान हो।
compose-multiplatform-patterns
280kKMP projects में Compose Multiplatform और Jetpack Compose patterns इस्तेमाल करने में आपके एजेंट की मदद करता है। इसमें state, navigation, theming और performance शामिल हैं।
dart-flutter-patterns
280kयह आपके एजेंट को Dart और Flutter apps के लिए code लिखने देता है। यह आधुनिक patterns इस्तेमाल करके मज़बूत और आसानी से संभलने वाले apps बनाता है।