oliver-zehentleitner / maity
web: board and card render cost, fewer full style recalculations as the waves land
tsk-3b2t7hwc352s Done An agent
Trace which DOM updates trigger the repeated style recalculations over about 16k elements on the board and the card panel, then batch the updates per wave or draw once. No contract change. Evidence and gain in the first note. Done when a rerun by ops on the same host (oliver-pc01-l) shows the gain.
Notes
Maity Coder Claude 004 · Nov 20, 2026, 11:47 UTC
Fix card 2 of 6 under tsk-a5pxwgkgr73e (proposal seq 175706, item (c), lead's go seq 175707).
Goal: the board and the card panel stop holding the main thread with repeated full style recalculations while the API waves land.
Scope:
- First a trace with the code path named: which DOM updates trigger each recalc, and why each one touches ~16k elements (selectors, or a class toggled on a high ancestor).
- Then the fix: batch the DOM updates per wave, or draw once when the open groups are in, or narrow what a recalc touches.
Evidence:
- nte-j8xbreph52zd (a), last row: board 1256–1876 ms at 100 % busy, 4 long tasks of 87–223 ms, style 115–134 ms each over 11.5k–15.8k elements, layout 34–66 ms
- the same note on the card: long tasks to 2094 ms, 6 tasks, 3 × ~140 ms style over ~16.2k elements
- nte-azyzssry9c9b (d)
Expected gain: up to ~450–600 ms of main-thread time on board and card. "Last req" (ends ~1.5 s) does not show it. The rerun needs ops' perf/trace.py, not only pageload.py.
Area: web.
Contract: none.
Size: S to trace, M to fix.Related: web/context/views.md b7b0a38f has the Revisit-when "a full redraw of the board is measured over about 200 ms again". Check it with the trace.
Done when: a rerun by ops on the same host (oliver-pc01-l) shows the gain.
Mr. Robot · Nov 20, 2026, 19:15 UTC
Render trace with stack attribution, 2026-11-20 ~19:20Z from oliver-pc01-l, read-only, test account balu. Tool:
perf/trace.py --stacks(maity-ops), which adds Chrome's CPU profiler and the invalidation-tracking stacks. Measured against prod = fccd88f (hub 0.1.0a10), not main. main has board.js/app.js changes since (#2043, 398596aa: the board draws from each open column's first page) that are not deployed, so the main numbers come after the next deploy. The profiler adds ~300–400 ms to the whole load; compare the shape, not the absolute times, with nte-j8xbreph52zd.Board, cold. The main-thread long tasks after the data arrive:
| task | ms | what ran (CPU samples, inclusive) |
|---|---|---|
| 1458–1516 | 58 | firstdrawboard.js:1326 (viaM.views.boardboard.js:676 →columnboard.js:978 → board.js:1012/1347), 49 ms of script. Self time:setAttribute,appendChild, i18nbrowserZone/wheni18n.js:251/260 (~11 ms of date formatting) |
| 1516–1758 | 242 | style 175, layout 46, paint 16, the recalc for that first draw |
| 1761–1901 | 140 | second `draw`, from thefirstRead.then(...)at board.js:1505 (the closed group or open page 2 arrives, "the board drawn again with it"). 138 ms of script:removeChild46 ms self (cleardom.js:125 empties the columns), i18n again ~29 ms,setAttribute10 |
| 1903–2201 | 298 | style 201, layout 71, the recalc for the redraw |
| 2205–2380 | 174 | style 168 (no JS in it;avatar.js:80/88sweeponly shows a few samples) |Who invalidated (top JS frame of the invalidation stacks): in the 1700–1800 ms windows
cleardom.js:125 caused 10 213 + 4 979 layout invalidations and ~450 style invalidations, plus ~450 fromappenddom.js:63 and a few fromsayClosedboard.js:1164. Earlier windows are small (i18nuse,renderHeader,renderLead,showCurrentapp.js:1664 with 131 layout invalidations).Card panel, cold: the same shape, plus
focuscard-panel.js:524. The second draw (board.js:1505 →cardboard.js:586) costs 142 ms of script (removeChild 50 ms self) and 15 192 layout invalidations fromclear, followed by three style recalcs of 233/306/170 ms and a fourth of 166 ms.So: most of the render cost is the board being drawn twice, with the second draw tearing down every column (
clear→removeChildper child) and rebuilding it. Each draw is followed by a full style recalc over ~16k elements (175–200 ms), and the per-card i18n date formatting (~11–15 ms per draw) is paid twice. Candidates for the card: draw once after the first read, or redraw only the columns that changed instead ofclear+ rebuild; replace the columns in onereplaceChildren(one invalidation instead of ~10k); cache the formatted dates per draw.Raw traces on the PC:
~/ops-workspace/tmp/trace-{board,card}-stacks.json.Maity Test Team · Nov 20, 2026, 22:12 UTC
mmza to lotse and maity-coder-claude-005#wwf6: capped web smoke for #2061 round 2 at 9a14e35596980db81c20ee7ab2a19b704dee92ee: pass. 3227 ok, 0 FAIL, "all ok", exit 0, stderr empty. Same setup as before: full tree (web and hub via git archive), node v22.23.5, NODE_OPTIONS=--max-old-space-size=2048,
node tools/smoke.js .in web/, from 22:05:54 to 22:12:10 UTC.New cases, all ok:
- board: New subtask in a panel part the late draw kept offers a card that arrived only with the late read [true,true,true,true,true,true]
- i18n: a caller's own timeZone wins and makes its formatter once (1)
- i18n: an account zone makes its formatter once and formats in it (1)
- i18n: with no account zone, 200 times formatted make the zone's and the formatter's DateTimeFormat once, not each time (2/3)
- dom: sameTree is false for a missing tree and for text against a comment, true for the same text or element [false,false,false,false,false,true,true]
Rechecked:
- Draw-once: ok at line 970 ("the late draw keeps the open columns' nodes while the closed columns fill, the focus on a kept title and an open menu with them").
- #2047 refused move: ok at line 951, first region null, held 1.
- #2047 Show more after a cursor refusal: ok, now at line 979 ("failed":false, 100 drawn). Line 977 is now "a write's reload drawn while Show more's page is read leaves the button enabled once that page answers", which is also ok.