Skip to content

perf(qml): Drop the file selectors#20696

Open
alexjba wants to merge 1 commit intoperf/async-messengerfrom
perf/drop-file-selectors
Open

perf(qml): Drop the file selectors#20696
alexjba wants to merge 1 commit intoperf/async-messengerfrom
perf/drop-file-selectors

Conversation

@alexjba
Copy link
Copy Markdown
Contributor

@alexjba alexjba commented May 1, 2026

What does the PR do

Dropping the qml file selectors (even the default ones)

Needs status-im/dotherside#108

The QML file selectors are on top of the CPU offenders on start-up, on the qml compilation time. Most of the work done by the file selectors is on the qml thread, but it flows into the main thread as well.

By removing the qml file selectors I'm getting more than 3 sec CPU drop on the QQmlThread warm-start-up. This will also speed-up the main thread (probably less waits). The qml compilation time is reduced and assets are loaded faster.

The Browser was the only component still using the file selectors. I've replaced the file selectors with Loader.setSource

Affected areas

QML engine configuration
Browser

How to test

run make mobile-profile (make sure you have a device connected)
After app start -> attach the qml profiler to allow the app to start -> login -> close the app -> wait for the profiler tcp connection to close
Start the app again -> attach android studio CPU profiler -> attach the qml profiler

Inspect the CPU time.

Risk

Medium for browser

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented May 1, 2026

Jenkins Builds

Click to see older builds (9)
Commit #️⃣ Finished (UTC) Duration Platform Result
fe8ffea 1 2026-05-01 12:42:00 ~50 sec android/arm64 📄log
✔️ fe8ffea 1 2026-05-01 12:49:12 ~7 min tests/nim 📄log
✔️ fe8ffea 1 2026-05-01 12:53:20 ~12 min tests/ui 📄log
✔️ fe8ffea 1 2026-05-01 12:54:41 ~13 min ios/aarch64 📱ipa 📲
✔️ fe8ffea 1 2026-05-01 12:57:16 ~16 min linux/x86_64 📦tgz
✔️ fe8ffea 1 2026-05-01 12:58:46 ~17 min macos/aarch64 🍎dmg
✔️ fe8ffea 11035 2026-05-01 13:15:08 ~17 min tests/e2e 📊rpt
✔️ fe8ffea 1 2026-05-01 13:18:12 ~36 min windows/x86_64 💿exe
✔️ fe8ffea 3014 2026-05-01 13:37:44 ~19 min tests/e2e-windows 📊rpt
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 16bc15b 2 2026-05-01 14:11:02 ~8 min tests/nim 📄log
✔️ 16bc15b 2 2026-05-01 14:15:41 ~12 min ios/aarch64 📱ipa 📲
✔️ 16bc15b 2 2026-05-01 14:15:49 ~12 min tests/ui 📄log
✔️ 16bc15b 2 2026-05-01 14:17:29 ~14 min macos/aarch64 🍎dmg
✔️ 16bc15b 2 2026-05-01 14:18:51 ~15 min linux/x86_64 📦tgz
✖️ 16bc15b 2949 2026-05-01 14:33:57 ~21 min tests/e2e-android 📦pkg
✔️ 16bc15b 2 2026-05-01 14:40:52 ~37 min windows/x86_64 💿exe
✖️ 16bc15b 11037 2026-05-01 14:43:39 ~24 min tests/e2e 📊rpt
✔️ 16bc15b 3016 2026-05-01 15:00:30 ~19 min tests/e2e-windows 📊rpt
✔️ e60d0f69 2 2026-05-01 14:12:01 ~9 min android/arm64 🤖apk 📲

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes QML file selector usage and switches the Browser WebView adapter selection to an explicit Loader.setSource approach, aiming to reduce QML compilation/startup CPU overhead (especially on mobile warm start).

Changes:

  • Replace file-selector-based Browser adapter overrides with runtime adapter loading via Loader.setSource.
  • Add a mobile-specific MobileWebViewAdapter backed by StatusQ.CustomWebView and expose it in the adapters module.
  • Remove the +mobile and +noWebEngine selector directories/usages, including Storybook and Nim-side selector configuration.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/app/AppLayouts/Browser/adapters/qmldir Exports MobileWebViewAdapter from the adapters module.
ui/app/AppLayouts/Browser/adapters/ProfileManager.qml Drops static QtWebEngine import; adds mobile guards and uses numeric enum values for script injection configuration.
ui/app/AppLayouts/Browser/adapters/MobileWebViewAdapter.qml New mobile adapter using MobileWebViewBackend with history/find/snapshot and web actions plumbing.
ui/app/AppLayouts/Browser/adapters/LazyWebViewAdapter.qml Switches from selector-resolved sourceComponent to runtime setSource with per-platform adapter path and bound properties.
ui/app/AppLayouts/Browser/adapters/+mobile/qmldir Removed (no longer using file selectors).
ui/app/AppLayouts/Browser/adapters/+mobile/ProfileManager.qml Removed (mobile behavior moved into shared ProfileManager.qml).
ui/app/AppLayouts/Browser/+noWebEngine/BrowserLayout.qml Removed (no longer using file selectors).
storybook/qmlfilesserver_main.cpp Removes Storybook file-selector setup (+noWebEngine).
src/nim_status_client.nim Removes Nim-side QT_FILE_SELECTORS manipulation for mobile.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread storybook/qmlfilesserver_main.cpp
Comment thread ui/app/AppLayouts/Browser/adapters/ProfileManager.qml
Comment on lines 22 to 26
name: name,
sourceUrl: path,
injectionPoint: WebEngineScript.DocumentCreation,
worldId: WebEngineScript.MainWorld,
injectionPoint: 2, //WebEngineScript.DocumentCreation
worldId: 0, //WebEngineScript.MainWorld
runsOnSubFrames: runOnSubFrames
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

Hard-coding injectionPoint: 2 and worldId: 0 is brittle and obscures intent (these are QtWebEngine enum values). Consider defining named constants in this file (with a reference to the QtWebEngine docs), or retrieving the enum values via a small Qt.createQmlObject helper so the mapping stays correct across Qt upgrades.

Copilot uses AI. Check for mistakes.
@alexjba alexjba force-pushed the perf/drop-file-selectors branch from fe8ffea to 16bc15b Compare May 1, 2026 14:02
Copy link
Copy Markdown
Contributor

@friofry friofry left a comment

Choose a reason for hiding this comment

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

Looks good to me!

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.

4 participants