Skip to content

Optimize Compose app list rendering and incremental loading#14

Merged
Dev97633 merged 1 commit intomainfrom
codex/optimize-compose-performance-tuning
Apr 7, 2026
Merged

Optimize Compose app list rendering and incremental loading#14
Dev97633 merged 1 commit intomainfrom
codex/optimize-compose-performance-tuning

Conversation

@Dev97633
Copy link
Copy Markdown
Owner

@Dev97633 Dev97633 commented Apr 7, 2026

Motivation

  • Reduce micro-stutter and GC churn when loading and displaying the app list by avoiding repeated list copying and expensive per-frame draw work.
  • Make incremental chunked loading, filtering and per-item updates much cheaper so the UI can show first content quickly and remain smooth during scrolls and updates.

Description

  • Replaced var allAppData by remember { mutableStateOf<List<AppData>>(emptyList()) } with val allAppData = remember { mutableStateListOf<AppData>() } and added a lightweight appDataVersion (mutableIntStateOf) to signal meaningful item changes.
  • Changed refresh logic to allAppData.clear() + allAppData.addAll(chunk) instead of allAppData = allAppData + chunk to avoid list copying and broad recompositions.
  • Switched single-item updates to in-place indexed replacement (allAppData[targetIndex] = ...) and bump appDataVersion to allow targeted downstream updates.
  • Replaced derivedStateOf filtering keyed on the whole list with a produceState that is keyed by query, filters, allAppData.size, and appDataVersion to debounce / reduce filter recomputation.
  • Removed the per-item drawBehind custom line drawing and added a HorizontalDivider in the item layout to avoid per-frame draw callbacks during scroll.
  • Reduced decoded icon bitmap size from 80x80 to 48x48 and changed the loading path to chunk-first then sort-per-chunk (.chunked(30) + .sortedBy { it.appName }) to improve first-paint latency and reduce upfront sorting cost.

Testing

  • Attempted to compile Kotlin with ./gradlew :app:compileDebugKotlin, which failed in this environment with /bin/bash: line 1: ./gradlew: Permission denied and environment JAVACMD issues.
  • Attempted bash ./gradlew :app:compileDebugKotlin, which also failed due to the environment's missing Java runtime (exec: : not found).
  • No automated unit or instrumentation tests were executed successfully in this environment; code changes were validated via static inspection and local edit/run commands only.

Codex Task

@Dev97633 Dev97633 merged commit 183bc1c into main Apr 7, 2026
1 check passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1836903c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

for (chunk in sortedPackages.chunked(30)) {
for (chunk in packages.chunked(30)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve global app sorting when loading in chunks

Chunking packages before sorting only orders apps within each 30-item block, so the final list order now depends on the package manager’s enumeration order instead of a global app-name sort. On devices with more than one chunk, this makes the main list and filteredAppData.take(10) suggestions non-alphabetical and unstable across refreshes, which is a user-visible regression from the previous globally sorted behavior.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant