← 输入框|github.com|刷新
Skip to content

perf: inflate and bind settings tabs lazily - #113

Merged
LeanBitLab merged 1 commit into
mainfrom
perf/lazy-settings-inflation
Nov 24, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
perf/lazy-settings-inflation

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Opening the settings screen took ~3.2s cold (debug build, 44-138 skipped frames); inflating the 2000-line activity_main.xml was ~1.5s of that.

  • The four tab containers moved into tab_style/content/layout/system.xml and are ViewStubs in activity_main.xml (2000 -> ~280 lines).
  • Only the saved tab is inflated and bound before the first frame; the others are inflated one at a time while the main thread is idle.
  • Anything spanning tabs (search, tab switch, permission results) binds all tabs first via ensureAllTabsReady(). checkAllPermissions() tolerates views that are not inflated yet. bindReorderSection() now runs with the Layout tab instead of inside the theme setup.
  • check_strings.py also scans tab_*.xml for hardcoded text.

Measured on a device (debug, cold start): ~3.2s -> ~2.3s; setContentView ~1500ms -> 40-150ms. Binding the visible Style tab (~0.6-1s) is now the main remaining cost.

Verified: check_strings.py, full testDebugUnitTest (new tests: only the selected tab is inflated before idle, all tabs ready once idle, launch with each saved tab), lintDebug, device launch with each of the four saved tabs (no crash). Not clicked through by hand: tab switching, cross-tab search, permission rows, language change.

@LeanBitLab
LeanBitLab merged commit 2adb21a into main Nov 24, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the perf/lazy-settings-inflation branch November 24, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant