With 600 accounts the Claude provider editor took 7.9s to open in WebKit
(2.3s in Chromium). Each account's segmented control placed itself, and its
thumb, in a microtask of its own: a read after the last control's write, so
every control laid the editor out again. The thumb's place was read from
offsetLeft/offsetTop, scrollLeft and getComputedStyle. In a long list WebKit
answers those by walking every sibling before the element (~0.3ms each at
600 accounts), where getBoundingClientRect, offsetWidth and client/scroll
sizes are cheap.
- segs() queues its control. One microtask (segsFlush) places every control
due and slides them all together, with each container's controls counted
once (segsPlace takes a shared map).
- slides() reads every thumb's target, then writes them all. thumbsPut puts
them all with one reflow.
- thumbTo measures with rects (unscaled by offsetWidth) and reads scrollLeft
or scrollTop only when the strip overflows.
- thumbNow trusts the place it last put (thumbPlaced) unless a glide is
running, so it doesn't use computed style.
Measured at 600 accounts (time to open the editor, probe on mote):
| | WebKit | Chromium |
| --- | --- | --- |
| before | 7.9s | 2.3s |
| after | 1.13s | 0.58s |
What's left in WebKit is the editor's own two renders and openModal
(~670ms), which this commit doesn't touch.
The core scripts stay inside TestCoreScriptBudget: comments were cut to pay
for the code, and the budget wasn't raised.
New test: editor-thumbs-batched.test.cjs. It opens the editor with 40 and
with 160 accounts, in both engines and in en/zh/zh-TW/ja/de. It counts
forced layouts and the sibling-walking reads, holds 160 to 40's count +24,
and checks every thumb lies under its option within 1px.
Run at this head (rebased on ab3710de3), on mote:
- TestCoreScriptBudget: ok.
- editor-thumbs-batched, i18n-keys and quota-fit-batched: all ok, in both
engines.
- tencent-cloud: the "strip scrolled" test is red 4 of 4, as it is on main
(#4321). It fails before any click, at "the strip scrolls (0px)".
Run on the tree before the last comment trims (base 7e5cebb86):
- The 109 GUI files that touch thumbs, .segs, slide() or segsPlace, plus
i18n-keys: 2,099 tests, 39 red.
- The 7 files with reds were rerun at both the fix and the base. They give
the same reds on both (40 at fix, 39 at base; the extra one is skill-where
webkit, which is red only at base). Each is filed: tencent-cloud #4321,
settings-groups #5828, gateway-mode #3586, s3-sync #2448, skill-where
#5154, and masking-records #5830 (new). The panel-usage reds are the same
32 at fix and base.
Broken by hand, with the new test:
- Old assets: forced layouts 294 → 654 (WebKit), 296 → 656 (Chromium).
- thumbTo reading offsetLeft/offsetTop again: slow reads 650 → 1132
(WebKit), 787 → 1267 (Chromium).
- thumbNow on computed style again: slow reads 290 → 415 and 352 → 456.
Each goes red.
Not tried: the real app with 600 real accounts. The numbers come from the
page under Playwright's WebKit and Chromium with fake accounts. Not tried
in WebKitGTK either; there is no new browser API and no new motion.