工具
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
效能問題有時很難找出原因,也很難得知該從哪段程式碼開始最佳化。這時不妨先用工具縮小問題範圍。
版面配置檢查器
使用版面配置檢查器檢查版面配置,並查看重組次數。
如果您的 UI 效能不佳,這通常是因為程式碼錯誤導致強制過度重組 UI。另一方面,某些程式設計錯誤也可能會導致 UI 在需要變更時無法重組,畫面中因此就不會顯示 UI 的變更。追蹤重組可以幫助您找出這兩種問題。
重組本身並不是壞事;然而,非預期重組可能會造成問題。
詳情請參閱版面配置檢查器重組計數說明文件。
組合追蹤
使用組合追蹤功能,在系統追蹤期間追蹤可組合函式。首次探究效能問題時,追蹤記錄通常是最佳資訊來源。追蹤記錄可用於擬定假設,並決定該從何處著手。
其他資源
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-30 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-30 (世界標準時間)。"],[],[],null,["# Tooling\n\nIt can be hard to know where a performance issue lies and what code to start\noptimizing. Start by using tools to help narrow down where your issue is.\n\nLayout Inspector\n----------------\n\nUse the [Layout Inspector](/develop/ui/compose/tooling/debug#layout_inspector) to inspect your layout and see recomposition\ncounts.\n\nIf your UI has poor performance, this is often because of a coding error that\nforces your UI to be recomposed excessively. On the other hand, some coding\nerrors can prevent your UI from being recomposed when it needs to be, which\nmeans UI changes aren't showing up on the screen. Tracking recompositions can\nhelp find both of these kinds of problems.\n\nRecomposition in itself is not bad; however, unexpected recomposition can be an\nissue.\n\nFor more information, see the Layout Inspector [recomposition counts](/develop/ui/compose/tooling/debug#recomposition-counts)\ndocumentation.\n\nComposition tracing\n-------------------\n\nUse [composition tracing](/develop/ui/compose/tooling/tracing) to trace your composable functions in a system\ntrace. Traces are often the best source of information when first looking into a\nperformance issue. They allow you to form a hypothesis of what the issue is and\nwhere to start looking.\n\nAdditional Resources\n--------------------\n\n- **[App performance guide](/topic/performance/overview)**: Discover best practices, libraries, and tools to improve performance on Android.\n- **[Inspect Performance](/topic/performance/inspecting-overview):** Inspect app performance.\n- **[Benchmarking](/topic/performance/benchmarking/benchmarking-overview):** Benchmark app performance.\n- **[App startup](/topic/performance/appstartup/analysis-optimization):** Optimize app startup.\n- **[Baseline profiles](/baseline-profiles):** Understand baseline profiles."]]