Files
magpie/internal
yetone ac3a2a3df5 routing: the page asks for frames only while its stage moves, and the live dot pulses only while a request is under way (#2827)
zhang-4411 (#2827): under xrdp/X11 with no GPU the Routing page's web
process took 459%-830% CPU. Beside compositing (27353a952), the page
itself drew on every frame while nothing moved: its frame loop asked for
the next frame forever once Routing was shown, and the live dot's rtlive
pulse ran with no request under way. On llvmpipe each of those frames is
rasterised on the CPU.

Now the loop stops once nothing on the stage moves and is kicked again
by what makes something move (a request arriving, a replay, the page
shown again). The dot pulses (.rt-livedot.on) only while a request is
live. With no request, the page asks for no frames.

Measured in the GUI harness (scratchpad measure.cjs, 4s windows,
Playwright on macOS, load average ~200):
- chromium, Routing idle: before 70 ms CPU/s, 60.3 rAF/s, 1 running
  animation (rtlive); after 4 ms CPU/s, 0 rAF/s, 0 animations
- webkit, Routing idle: before 62 rAF/s, 1 animation; after 0 rAF/s,
  0 animations (WebKit's per-process CPU reading was negative under
  this load, so only frames are given)
- Routing busy (requests moving) is unchanged: chromium 176 -> 186 ms
  CPU/s, ~64 rAF/s both

Run:
- tests/routing-idle-frame.test.cjs (webkit, en and zh, as the file
  runs): 9 pass 0 fail. It now also counts the frames asked for with
  nothing moving and checks the dot's animation; MAGPIE_ROUTING_ASSETS
  points it at an older asset tree.
- Same test on the old assets (9fd80b212's, MAGPIE_ROUTING_ASSETS):
  FAIL "the Routing loop kept asking for frames with nothing on its stage
  moving (26 frames in 400ms)".
- Broken by hand (animation back on .rt-livedot): FAIL "the live dot
  pulsed with no request under way". Restored.
- Routing GUI files, chromium and webkit, every language: 1104 tests,
  1086 pass, 18 fail. Every one of those 18 fails the same way on the
  old assets in the same run (base 22 fail, new 20 fail on the reruns):
  routing-bodies "opens to its request and response", and under load
  routing-model-rest, routing-keys-fold, routing-request-metrics and
  routing-wb-restricted. All are in #2658 (and #2559). The one red only
  on the new side, routing-wb-restricted zh-TW 420px, passes rerun alone
  in both engines.

Not tried: WebKitGTK, xrdp or llvmpipe. Playwright's WebKit is not
WebKitGTK, so the CPU the reporter sees is not measured here.
2026-10-20 20:23:53 +08:00
..
…
…