UNscientific-9 (#2524): picking a day on Routing's request list froze the
page for seconds with thousands of rows. renderLog built a row for every
request of the day (~20 elements each, up to 2,000 a day) and put the new
ones in among the old row by row, so both days' rows were in at once.
Beside that, metaFit was run by a ResizeObserver on the column's every
change of size; the meta-under mark it sets changes the column's height,
which measured every row's numbers again (the reporter saw 8 runs in 8s,
~200ms each).
Now:
- A list of 300 or more items is windowed: only the rows in and near
sight are drawn, between two aria-hidden gaps as tall as the rows above
and below. A drawn row's height is measured and kept; one never drawn
counts as the average. Scrolling or a resize draws the rows then in
sight, once a frame, and the first row in sight stays where it was.
- The columns stay as wide as before: for each shape of row not drawn
(its time's digits, model and kind, its numbers), one unseen, inert
zero-height probe row stays in the grid, so the auto columns size by
it. The digits are tabular, so a probe stands for its shape.
- A list made mostly anew (another day) is put in with one
replaceChildren, not row by row among the old ones.
- metaFit runs on a change of the column's width only. When it moves the
numbers under or back, the list is drawn again for the new heights.
- A row's clock uses one cached Intl.DateTimeFormat.
Under 300 items the list is drawn whole, as before.
Not done here, from the reporter's list: drawAll still runs renderHist on
a static day at each poll. Measured with a live request arriving every
250ms while a 2,000-row day was shown (scratchpad dayidle.cjs, chromium,
4s): frame callbacks 330 / 211 ms total / 9 ms longest before, 90 / 52 ms
/ 4 ms after. A guard there would have to know every input of renderHist
(now(), lifted rests, names), so it was left out. Trimming prompt.parts
from the payload is on the server, not here. The renderer crash on
repeated switches was not reproduced.
Measured (scratchpad dswitch.cjs, 2,000 rows a day, 1280x900, five day
switches each, wall ms / longest block ms, load average ~220-290):
- chromium before: 379/304 454/374 452/374 474/389 427/376, rows=2000,
~39,740 elements
- chromium after: 56/22 61/20 56/19 74/21 410/17, rows 17-21, ~1,520-
1,600 elements (the 410 is wall time under load; its longest block 17)
- webkit before: 565/461 624/493 639/526 625/516 616/516, rows=2000
- webkit after: 117/37 95/25 93/30 128/26 138/25, rows 17-21
- same grid columns and list height after as before, in both engines:
chromium "89.4375px 94.1875px 661.078px 181.297px", scrollHeight 61602;
webkit "89.4375px 94.1875px 641.078125px 181.296875px", 61602
Run:
- tests/routing-day-window.test.cjs (new), chromium and webkit, en zh
zh-TW ja de, 1280px and 420px: 30 tests, 30 pass. It picks a 2,000-row
day, checks the rows drawn are bounded and the list is as tall as all
of them, scrolls to a wide model far down (columns unchanged, not cut),
holds a row still across frames mid-list, reaches the last row and picks
it, switches day, and goes By session to the list's foot. The second
test grows the column taller three times and counts reads of the
numbers' boxes: 0, and >0 on a new width.
- Same test on the old assets (MAGPIE_ROUTING_ASSETS, the routing
client.js/css before this change), chromium en: 3 fail, "a day of 2000 put 2000 rows in
the list" (both widths) and the measure test (12000 reads, not 0).
- Broken by hand: WIN_MIN 300 -> 300000 fails "a day of 2000 put 2000
rows in the list"; the width guard taken out fails "156 !== 0" in both
engines. Both restored.
- tests/routing-sessions.test.cjs: its 2,001-request history test now
scrolls to a session's group instead of expecting all 2,001 rows in the
DOM. 8 pass, 0 fail (chromium and webkit, en and zh).
- routing-*.test.cjs, panel-routing*.test.cjs and every other GUI file
that reads the request list (claude-auth-status, claude-subagent-tag,
dates-gui-lang, click-scroll, codex-subagent-model, codex-credits,
desktop-subagent-model, key-nourl, phone-rows, reasoning-speed,
remote-group-served, purpose-filter, search-instead, rest-try-now,
search-mcp, vision-mcp), both engines, every language, concurrency 4:
1412 tests, 1390 pass, 22 fail. 18 of those are routing-bodies,
routing-keys-fold, routing-model-rest, routing-request-metrics and
routing-wb-restricted, which fail the same way on the old assets
(#2658, #2559). The other 4 (rest-try-now chromium en 1100 and ja 420,
routing-log-icons webkit zh, routing-time-went chromium de) pass when
their files run alone: 64 tests, 64 pass.
Not tried: WebKitGTK and the Windows WebView2 app (where the reporter's
seconds-long freeze was on Windows); the numbers above are Playwright's
Chromium and WebKit on macOS.