Fixed
Status Update
Comments
an...@google.com <an...@google.com> #2
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 69c9a580f0bf6f05163b711e5c1978f383f99402
Author: Andrei Shikov <ashikov@google.com>
Date: Tue Oct 11 02:33:32 2022
Reuse nodes across subcompose layout boundary
Enables reuse for subcompose layout node triggering reuse instead of dispose whenever composition is put inside ReusableContent. Subcomposition dispose is tied to `onDetach` of the corresponding node instead, which is triggered when node exits composition entirely.
Reusing nodes should improve performance in subcompose layouts inside lazy containers.
Fixes: 252846775
Test: LazyColumnTest/SubcomposeLayoutTest
Change-Id: If2df818639223abfa9d8d1e48af74b8f9e3ceeb1
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListSlotsReuseTest.kt
M compose/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
A compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyBoxWithConstraintsActivity.kt
A compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/LazyBoxWithConstraintsScrollBenchmark.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyListSlotsReuseTest.kt
https://android-review.googlesource.com/2247915
Branch: androidx-main
commit 69c9a580f0bf6f05163b711e5c1978f383f99402
Author: Andrei Shikov <ashikov@google.com>
Date: Tue Oct 11 02:33:32 2022
Reuse nodes across subcompose layout boundary
Enables reuse for subcompose layout node triggering reuse instead of dispose whenever composition is put inside ReusableContent. Subcomposition dispose is tied to `onDetach` of the corresponding node instead, which is triggered when node exits composition entirely.
Reusing nodes should improve performance in subcompose layouts inside lazy containers.
Fixes: 252846775
Test: LazyColumnTest/SubcomposeLayoutTest
Change-Id: If2df818639223abfa9d8d1e48af74b8f9e3ceeb1
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListSlotsReuseTest.kt
M compose/integration-tests/macrobenchmark-target/src/main/AndroidManifest.xml
A compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyBoxWithConstraintsActivity.kt
A compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/LazyBoxWithConstraintsScrollBenchmark.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyListSlotsReuseTest.kt
be...@google.com <be...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 6f2e0ab896044dbc21a00cf28f65b9df962fb192
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Dec 21 00:10:54 2022
Reuse nested compositions in SubcomposeLayout
Updates `SubcomposeLayout` to reuse subcompositions when the layout itself is reused. Subcompositions are kept around if the `SubcomposeLayout` node is reused or deactivated and are disposed on release.
Adds a interface for subcompositions with overloaded `setContent` that forces reuse to work around same-frame reset/composition cycle.
Test: Updated UI/foundation tests
Relnote: """Add `ReusableComposition` interface for managing lifecycle and reuse of subcompositions."""
Fixes: 252846775
Change-Id: I812d1fa36791857a04471882d5edabea1400c15e
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListSlotsReuseTest.kt
M compose/runtime/runtime/api/current.txt
M compose/runtime/runtime/api/restricted_current.txt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
M compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
M compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/Wrapper.skiko.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyListSlotsReuseTest.kt
https://android-review.googlesource.com/2404404
Branch: androidx-main
commit 6f2e0ab896044dbc21a00cf28f65b9df962fb192
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Dec 21 00:10:54 2022
Reuse nested compositions in SubcomposeLayout
Updates `SubcomposeLayout` to reuse subcompositions when the layout itself is reused. Subcompositions are kept around if the `SubcomposeLayout` node is reused or deactivated and are disposed on release.
Adds a interface for subcompositions with overloaded `setContent` that forces reuse to work around same-frame reset/composition cycle.
Test: Updated UI/foundation tests
Relnote: """Add `ReusableComposition` interface for managing lifecycle and reuse of subcompositions."""
Fixes: 252846775
Change-Id: I812d1fa36791857a04471882d5edabea1400c15e
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListSlotsReuseTest.kt
M compose/runtime/runtime/api/current.txt
M compose/runtime/runtime/api/restricted_current.txt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
M compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/SubcomposeLayout.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
M compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/Wrapper.skiko.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSlotsReuseTest.kt
M tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyListSlotsReuseTest.kt
pr...@google.com <pr...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.tv:tv-foundation:1.0.0-alpha09
Description
We tried to enable that previously, but it caused subtle issues with such subcompositions ending up in an incorrect state so we reverted it here:
We should explore again how we can improve the performance of such use cases