A wire to a key hundreds of rows down is ~18,000px long, and WebKit
stroked every dash of it again on each frame it flowed (.live's
dashoffset animation), keeping Routing under 50 fps with both groups
open. Each live wire now gets a stroke-dasharray that is the usual
"3 5" only from a screen above to a screen below what is in sight,
started on a multiple of 8px so it stays in step with the whole
wire's, and a gap elsewhere. The edges move in steps of 200px, so
scrolling redashes a wire only now and then. layout() records where
the stage and the view were (it reads them anyway) and the view's
scroll events track the scroll, so flowNear forces no layout of its
own.
Where a wire crosses those edges is measured from its own d (magpie's
M, L, Q and C, each bend walked in 16 steps, edges moved out 64px).
A first version asked WebKit's getPointAtLength, which cost ~3.8ms a
call, 780ms per 15s with 800 keys: a wire's d changes with most
updates, so a cache missed 147 of 179 times. Measured from d it is
13ms per 15s.
Run:
- Sandbox magpie app, sandbox HOME, fake upstream under load, Routing
with both groups open (~900 rows), first version, WebKit paired runs
(old and new at once, 20s, 5 pairs): frames 913/914/936/912/893 ->
1012/1018/1029/1004/979 (about +10%).
- Page-route mock (routing-many-keys' 500 + 300 keys, a request every
300ms, both folds open), this version against v0.1.1558's client.js,
WebKit, 15s, 3 pairs at once: frames 840/843/844 -> 870/876/875,
on time (<18ms) 507/538/568 -> 660/670/668, jank over 16.7ms
1799/1693/1638 -> 1221/1187/1189ms. Chromium 901 -> 901 (60 fps).
- Coverage in the mock, WebKit and Chromium, wheeled to scrollTop 0,
4000, 9000, 15000, 22000, 30000, 2000, 0, read 40ms and 400ms after:
every point of every live wire inside the view (2824 sampled) lies
inside its dashed window. The first try of measuring from d missed
long straight L steps (a lane 5000px down got a window of 64px) and
this check caught it; crossings are now interpolated inside a step.
- GUI: all 108 routing*.test.cjs files at this change, both engines:
1341 pass, 47 fail, in 7 files that are red the same on c0985122b
run beside it (intent-entry 4/4 vs 4/4 on a second pair, live-patch
6/6, manual 2/2, pause 14/14, rule-effort 14/14, rule-remove 6/7,
steady 1/1), each filed: #3408, #3637, #3409, #3410, #3411, #3096,
#3412. routing-many-keys passes.
- node --check on client.js.
Not fixed: WebKit is still below 60 fps with both groups open. Hiding
rows past 40 gains more again, so the rest is the number of rows laid
out (rebuild alone is ~690ms per 15s); drawing only the rows in sight
is the next step on #3164.