Galaxy Shell / docs
Docs / Histórico

Performance of the workspaces overview, 2026-11-01

openspec/changes/archive/2026-11-01-performance-overview/design.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Este documento registra decisões, planejamento ou evidências de uma etapa do projeto. Não implica que todos os itens estejam implementados ou validados na versão atual.

Nesta página

Performance of the workspaces overview, 2026-11-01

Doc status: history. Dated measurement record of the workspaces overview, 2026-11-01, from nested runs. Checked 2026-11-10.

The project owner said the workspaces overview "ta bem ruim de performance e UI". This record covers performance only. It lists what was measured, what changed and what stays open. The numbers come from nested runs, so read the limits first.

Limits of these numbers

  • Nested run (scripts/nested-qa.py, nested QA). Both the nested compositor and the Electron GPU process drew with Mesa llvmpipe, a software renderer. A percentage here is CPU time of that software path, not GPU load. Use it to compare two states, not as a number for the real hardware.
  • Other agents used the machine at the same time (load average 12 to 17). A single sample moves by 20 percent or more. The tables give the samples that were taken, not an average of many runs.
  • The direct DRM session was not measured. The user has to check the result there.
  • Scene: 5 workspaces, one empty and four with one gnome-terminal window each (static text), overview opened with a Super tap, 1896x1032 output. CPU is the sum over a sampling window, 100 percent is one core.

How to measure

The compositor logs one line every two seconds, only when RUST_LOG names the frame_timing target:

RUST_LOG=frame_timing=info python3 scripts/nested-qa.py start
# the line is in the compositor.log of the run
frames=73 preview_requests=10 plane_renders=0 interval[27.86/35.15/48.32] preview[0.02/0.03/1.05] planes[0.00/0.00/0.00] scene[...] render[...] submit[...] total[...]

Each name[a/b/c] is average, 95th percentile and maximum in milliseconds. interval is the time between two frame starts. preview is the work of workspace previews before the frame, scene builds the elements, render is render_output (the DRM backend includes the GPU wait), submit is the buffer swap (nested) or the queue to KMS, total is the whole frame. preview_requests counts the preview requests that the loop processed in the window, rendered or skipped as unchanged. planes is the render of the live overview planes before the frame, and plane_renders counts the planes rendered in the window (phase 2 of docs/canvas-windows.md, added after the measurements of this record; the lines quoted below predate both fields). src/frame_timing.rs is the code. With the variable unset the calls return at once.

Causes, with numbers

1. Two backdrop blurs on a full-window dialog (fixed)

#workspace-overview had backdrop-filter: blur(24px) saturate(145%) and its ::backdrop had blur(16px). The dialog fills the window and is almost opaque, so the blur shows nearly nothing, and Chromium blurs the whole window again on each repaint (the caret, a preview, a hover).

CPU of the Electron GPU process, overview open and idle:

State Samples
Overview closed, idle 37.8 percent
Open, idle, blur on 82.2, 85.5, 83.2 percent
Open, idle, blur removed (same session, page reloaded) 36.5, 25.7 percent
Open and close four times in 17 s, blur on 63.4 percent
Open and close four times in 17 s, blur removed 28.0 percent

The renderer process stays at 5.6 to 9.4 percent open and 6.0 closed. The core is 2 to 4 percent. The overview HTML (card rebuild, getBoundingClientRect once per second, the signature check) is not a cause. The zoom animation was not measured: its code already animates only a compositor transform.

The blur is removed from both rules in host.css. web-shell/test/workspace-overview-css.test.js fails if a backdrop-filter returns on the overview.

2. Previews of unchanged workspaces (fixed)

The host asks for the visible previews once a second. Before, each request rendered the workspace into a 384x216 buffer, read it back, wrote a 249 KB PPM with sync_all, and the core read it, deflated it into a PNG and sent about 64 KB of base64 to the host. It did all of this even for an empty workspace and when nothing had changed.

Per frame, while the overview was open and idle (preview[avg/p95/max]):

avg max processed per 2 s
Before 0.08 to 0.14 ms 1.7 to 4.0 ms 4 to 8
After 0.02 to 0.04 ms 1.0 to 2.0 ms 5 or 10

One processed preview cost about 1.5 ms in the quiet nested run and 5 ms while the machine was loaded (compositor main thread, llvmpipe). The 12 previews a second that a 12-workspace desktop asks for would be 18 to 60 ms of that thread each second. After the change an unchanged workspace costs a signature hash. The core CPU went from 3.5 and 3.9 percent to 1.8 and 2.3 percent.

How it works:

  • Every commit of a window increments WindowMeta.commits.
  • scene::workspace_signature hashes what the preview draws: the output size, the focus selection, and for each non-shell window of the workspace in stacking order its id, commits (a commit of one of its popups counts too), minimized and floating state, location, drawn size, buffer size, the surface and position of each of its popups and, while it lasts (700 ms), the progress of its opening reveal. A menu or tooltip that maps, changes or goes away therefore renders the preview again. The wallpaper is not part of it.
  • The core asks with {"action":"workspace_preview","workspace":N,"if_changed":true} only when the compositor reports the capability workspacePreviewUnchanged and the core holds the last image of that workspace (same compositor instance, younger than 30 s since the core last read the image from the file; a read that gives the same pixels starts the age again). If the signature equals the one of the last published image, the compositor renders nothing and reports unchanged: true. The core answers with the cached PNG data URL.
  • The core drops its cached image whenever a read fails, a request is cancelled, the workspace is empty or closed, or the instance changes. The next request then asks for a new image. A compositor that restarts has no signatures.
  • An empty workspace (workspace_elements has no window) renders and writes nothing. The core already answered empty without reading the file.
  • The wallpaper can animate, so a change of the wallpaper alone does not refresh a thumbnail until the 30 s age limit.

Tests: workspace_preview_tests.rs (signature changes with a commit, a window that comes or goes, a move and a popup that maps, commits or goes, and not with another workspace; an EGL test, run with --ignored, sends requests through the real render path and checks that an unchanged or empty workspace writes no file), the unit tests in workspace_preview.rs, and the new cases in web-shell/test/workspace-previews.test.js and smithay.test.js.

3. A batch refused when it arrived under one second after the last (fixed)

The host sends one batch per second, counted from the start of its own cycle. The core refused a batch that started less than 1000 ms after the previous one (429). With timer and request jitter about every other batch fell under the limit. The host then marks every card of that batch unavailable, and the card shows the badge "Atualização pausada" until the next batch succeeds. This comes from reading the code. No 429 was logged. What was observed matches it: the compositor log showed 10 and 5 processed previews in alternating 2 s windows, and two screenshots of the open overview showed the badge on all four cards.

The minimum gap is now 800 ms (MIN_BATCH_GAP_MS). After the change the count was 10 in every window (a steady batch each second) and the badge did not show in the screenshot. The cap of one batch at a time and the 12 requests a second in the compositor stay. A request that ends unchanged is not counted against the 12, because it costs only a hash. Without this, a batch of 12 static cards that came 800 to 999 ms after the previous one met the compositor limit and every card went unavailable. A batch of 12 cards that all changed still meets the limit when it arrives under one second after the last; this was not measured.

Open, with numbers

  • Idle cost of the nested compositor is 250 to 380 percent of a core. The nested backend redraws the whole output each frame with llvmpipe, and submit (the buffer swap to the parent) is 6 to 9 ms of a 14 ms frame. This says nothing about the DRM backend. Measure the DRM session with frame_timing.
  • A changed workspace still renders once a second: about 1.5 to 5 ms in the frame loop, with a synchronous sync.wait() and a pixel readback. A workspace that changes every frame (video, a terminal with output) keeps this cost. A render on a worker or a lower rate for a busy workspace needs its own design.
  • A preview waits for the next state poll of the core, which runs every 100 ms (web-shell/core/smithay.js), and the batch asks for one workspace at a time. A first fill of 12 previews therefore takes at least about 1.2 s. This is derived from the code, not measured.
  • PNG encoding in the core: 1.0 to 1.7 ms per preview for a synthetic image (47 KB), with a thread pool for the deflate. A photographic wallpaper gives a larger file, up to the 380 000 character limit of the host. The unchanged path avoids it, a changed one still pays it.
  • The host still receives the full data URL of an unchanged preview. Sending only a marker would save 64 KB per workspace per second on loopback.

Contract changes

The compositor state reports capabilities.workspacePreviewUnchanged and workspacePreview.unchanged. The workspace_preview command takes an optional if_changed. The control socket still refuses unknown fields, so the core sends if_changed only with the capability. The preview contract in visual-effects-3d-shaders.md names these fields.