Repository navigation
perf(android): reduce Compose recomposition and virtual list churn - #427
Merged
Merged
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
There was a problem hiding this comment.
Devin Review found 6 findings. Devin automatically fixed all 6 findings.
Fixed by Devin (6)
- Standalone popover anchor bounds — Preserved the enclosing Box(propagateMinConstraints = true) wrapper for standalone LuiNodeKind.popover nodes in LuiChromeSurface.
- Missing Expressive theme in Drive — Keep MaterialExpressiveTheme mounted on root containers (ambientDark == null) in addition to nodes declaring theme-mode, so hosts like Drive sample still receive the Expressive theme.
- Unobservable stable backend properties — Backed LuiBackend.filePathResolver with mutableStateOf so @stable change-notification guarantees hold even if replaced after mounting.
- Theme switches drop editor focus — Removed the conditional CompositionLocalProvider branch inside LuiThemeScope themedContent so toggling theme-mode/foreground never remounts content or drops editor focus.
- Pinned editor remains partly offscreen — After bottom-aligned scrollToItem for a pinned row below the viewport, await one frame and scrollBy any remaining overflow if the measured row is taller than the estimate.
- Moved rows leave stale heights — Track lastHeight on RowIndexRef and immediately update heightStore.heights[index] when a keyed row shifts index without resizing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduce Android Jetpack Compose recomposition, state allocation, and scroll-jump overhead on hot list/editing updates (no public API, wire-contract, or non-Android changes):
LuiBackend(@Stable): allow Compose to skip unchangedLuiNodeView(backend, id)calls.LuiNodeView/LuiChromeSurface:backend.nodeKind(it)instead ofbackend.node(it)?.kindso parent containers do not subscribe to every child's snapshot state.LuiChromeSurfacewhencontextMenuId == null(avoids per-nodeBoxand twomutableStateOfallocations) and skip filteringnode.childrenwhen no auxiliarycontextMenu/swipeActionschild is present.LuiRender(luiChrome,luiGestures,LuiThemeScope):luiThemeColorlookups whenbackground/border-colorare unset.luiGestureswhen disabled or no gestures/context-menu/pointer handlers are active, avoiding unnecessarymutableStateOf/combinedClickable/pointerInputallocations.LuiThemeScopewhen a node declares no theme/typography/foreground overrides andLocalLuiThemeDark.current != null, and only wrap containers inMaterialExpressiveThemewhentheme-modeis set.LuiVirtualList:@StableRowHeightStore,RowIndexRef, andLuiVirtualRowItemso unchanged virtual rows skip recomposition when sibling indices shift.scrollBy/ bottom-aligned offset) instead of jumping them to the top of the viewport.Verification
platform/android/gradlew --no-daemon -p platform/android :lui:testDebugUnitTest :lui:lintDebug --console=plain—BUILD SUCCESSFUL.logseq/mobile500-block repeated-Enter Android benchmark (median reduced to 90–98ms, p95 132–135ms,native_editor_instances = 1).Link to Devin session: https://app.devin.ai/sessions/fd01f05d7f35485d99e7bbca3ea1a87d
Open in Devin Desktop: https://app.devin.ai/desktop/session/fd01f05d7f35485d99e7bbca3ea1a87d?variant=devin
Requested by: @tiensonqin
🟢 Devin fixed all 6 findings · Follow Devin's work