Skip to content

Latest commit

 

History

History
195 lines (141 loc) · 7.88 KB

performance.md

File metadata and controls

195 lines (141 loc) · 7.88 KB

UI performance: what was measured, and what it means

The device has 8 GB of RAM and 8 cores. When the interface felt slow, the question was always where the cost actually is — and the first three answers were wrong.

This document records the measurements, the hypotheses that were eliminated, and the one structural finding: there is no fixed platform frame-rate ceiling.


How to measure CPU correctly here

Three method mistakes were made before any of the numbers below meant anything:

Mistake Why it is wrong Do this instead
top -bn1 or ps %cpu for instantaneous CPU Both report a lifetime average, not current load Diff fields 14+15 of /proc/PID/stat over a known interval
Reading load average 12 as saturation Those were D-state vendor threads, not runnable work. vmstat showed 89–97% idle Trust vmstat, not load average, on a vendor kernel
nohup ... & for a long test over SSH Dies with the SSH session; the log file never appears systemd-run --unit=... --collect, verify with systemctl is-active

All figures below are single-core percentages derived from /proc/PID/stat.


The measurement

Scenario App CPU phoc CPU Observed fps
Phosh shell — — ~60
Nautilus, scrolling (scale 3) ~60% ~24% ~30
gnome-software, scrolling ~70% ~10% ~10

Both applications burn similar CPU, but Nautilus converts it into frames and gnome-software does not. Per frame, gnome-software costs roughly 3.5× what Nautilus costs.

Critically, phoc is only at 10% while gnome-software crawls — the compositor is not the bottleneck.

Hypotheses eliminated by measurement

Hypothesis Verdict
WebView / web engine ❌ gnome-software is native GTK4; no WebKit in the process map
Software rendering (Mesa/llvmpipe) ❌ eglinfo reports Mali-G72; process map shows hybris + mali, no swrast
Compositor / frame scheduling ❌ phoc is at 10% while scrolling
AppStream parsing ❌ Already cached: /var/cache/swcatalog/cache/*.xb (libxmlb, 8.6 MB)
Widget/content processing ✅ Confirmed — but not in the way first assumed

The scale experiment, and the wrong conclusion drawn from it

On Wayland, changing the output scale does not change the pixel count — the physical buffer stays 1080×2400. What changes is the logical area, and therefore how much content is on screen.

Scale Visible content Nautilus CPU phoc CPU Perceived smoothness
3 less ~60% ~24% ~30 fps
1.5 ~4× more ~65–81% ~14–18% essentially the same

The first reading was "phoc's load dropped → fewer frames → content cost". That was wrong, and the user's direct observation refuted it: smoothness barely changed. The phoc difference almost certainly came from scrolling intensity varying between samples (it fell to 43% and 15% in the last two runs — the scrolling had simply thinned out).

The correct reading: content quadrupled, smoothness did not change. So cost is not proportional to the amount of visible content, which also weakens the naive "widget count" hypothesis.


The structural finding: there is no fixed ceiling

Application fps Interface complexity
Phosh shell ~60 simple panels
Weather 40–50 a few simple widgets
Nautilus ~30 file list with icons
gnome-software ~10 image cards, badges, shadows

fps degrades smoothly with interface complexity. Combined with the scale experiment, this says the cost tracks widget type and complexity, not widget count. At scale 1.5 Nautilus drew many more rows, but they were the same cheap kind of row, so fps held.

Design consequences

  • 30 fps is not the target. A list interface at Weather-level simplicity looks reachable at 40+ fps — a 4× improvement over gnome-software's 10.
  • The expensive things are: image cards, shadow and rounding effects, complex row hierarchies. Avoiding those is where the win is.
  • Presentation feedback (see below) is a worthwhile separate improvement, but it is not the reason for the fps ceiling — Weather already manages 40–50.

Two incidental findings

  • ~/.cache/gnome-software holds 105 MB across 5,010 files, and screenshots are downloaded at desktop resolution: screenshots/1872x1053/. Far too large for a phone, and the reason pages load slowly and in pieces. (Scrolling generates zero network traffic — that is a separate symptom.)
  • The gs-plugin-flatp thread burns 1,728 ticks while zero flatpak applications are installed. Removing gnome-software-plugin-flatpak is a free win; the flatpak CLI keeps working.

Frame pacing: the wlroots presentation-feedback gap

A separate, real limitation: the wlroots hwcomposer backend does not deliver presentation feedback to clients — there is a recorded FIXME in the code. Without it, clients cannot pace themselves to vsync.

Tunable without rebuilding anything: WLR_HWC_IDLE_TIME. Setting it to 12 noticeably reduces the roughness and is shipped in the adaptation as a phosh.service drop-in.

Proper fix: patch wlroots to deliver presentation feedback. Since Droidian maintains that backend and it is a small project, this is a plausible upstream contribution.


Display scale change freezes the compositor

Previously not reproducible; triggered reliably with wlr-randr --scale.

phoc logs:

Timeout (3000ms) expired with 1 configures pending
phoc_layout_transaction_notify_layer_configured:
    assertion 'self->pending_layer_configures > 0' failed
A configure is scheduled for an uninitialized xdg_surface

Mechanism. On a scale change phoc starts a layout transaction, tells every client its new size and waits for acknowledgements. One client never acknowledges → the transaction hangs → the compositor blocks until the 3 second timeout. There is also an assertion failure in the transaction counter bookkeeping, so state is corrupted on the way through.

Recovery. Lock and unlock the screen. Recreating the surfaces resets the stuck transaction. (This is the same thing as the power-button trick found by accident.)

Fix direction. In phoc's layout transaction code: identify the non-acknowledging client, and continue gracefully on timeout instead of blocking. Source: https://github.com/droidian/phoc


Sketch: what a phone-appropriate store application would look like

Not a decision, just the profile the measurements imply.

Target: 40+ fps list scrolling, against gnome-software's ~10.

Technology: native GTK4 + libadwaita. Not a WebView — eliminated by measurement, since web content is already heavy on this device and adding a layer would make it worse.

Data layer:

  • Reuse the existing AppStream cache, /var/cache/swcatalog/cache/*.xb (libxmlb binary format, 8.6 MB — already compiled, no re-parsing)
  • Query through libappstream or appstreamcli
  • Installation through PackageKit D-Bus, or apt directly

Interface rules, derived from the measurements:

  • ❌ Image cards, shadows, corner-rounding effects
  • ❌ Complex row hierarchies
  • ✅ Flat, simple list rows — Weather-level simplicity
  • ✅ GtkListView with a model, so widgets are recycled

Image pipeline — one of the main wins:

  • Use the local icons already on disk: /var/lib/swcatalog/icons/droidian-rolling-main/ (3,780 icons at 48×48 and 64×64)
  • Fetch screenshots at phone resolution, not 1872×1053
  • Lazy-load; never decode an image while the list is scrolling

Deliberately out of scope: flatpak support, screenshot galleries, reviews and ratings, automatic update management.

Open questions: PackageKit or apt directly (PackageKit gives progress reporting but adds a layer; apt is simpler but needs privilege handling); and whether v1 is search-and-install only, or includes browsing by category.