Blocks #403, where a headed Chrome 154 session hangs on the first navigation
because the collector preload is 213 KB. That bisect showed the cost is payload
size alone, superlinear per script, and that our code is not implicated: 213 KB
of comment hangs identically.
The mitigations all cost something. Chunked registration needs the source
rebuilt from string parts and evaled, which a strict script-src CSP blocks,
so it trades a headed hang for silently losing DOM capture on exactly the pages
most likely to be real applications. Fetching the collector from the backend has
the same CSP exposure, and the JS service starts no backend in trace mode. A
preload script's body bypasses page CSP; anything evaluated from a string does
not. So the only route with no downside is to register less code.
What the bundle is
|
bytes |
share |
| parse5 |
148,535 |
69.5% |
| preact / htm |
47,549 |
22.2% |
| the collector itself |
17,717 |
8.3% |
Why the two big ones are there, and why they need not be
parse5 serves a round trip the page does not need. parseDocument reads
node.outerHTML, serialising the live DOM to a string, then parses that string
back into a tree. The collector is already standing in the document. Walking the
nodes directly produces the same tree without the serialize/parse pair, and is
strictly cheaper at capture time as well.
preact/htm builds vnodes the app does not consume as vnodes. transform in
packages/app reads the wire shape and calls h() itself, so the page side only
has to emit plain { type, props } objects.
Removing both takes the preload from 213 KB to roughly 18 KB, which the #403
bisect measures at baseline navigation cost.
Acceptance criteria
The page bundle registers well under 50 KB. DOM capture, replay and the A11y
tab are unchanged across all four adapters, verified on the examples rather than
by unit tests alone, since this is the fidelity-critical path. #403's headed
reproduction passes.
Size: L. The serializer is delicate and shared by every adapter, so this wants
its own verification pass rather than riding along with another change.
Blocks #403, where a headed Chrome 154 session hangs on the first navigation
because the collector preload is 213 KB. That bisect showed the cost is payload
size alone, superlinear per script, and that our code is not implicated: 213 KB
of comment hangs identically.
The mitigations all cost something. Chunked registration needs the source
rebuilt from string parts and
evaled, which a strictscript-srcCSP blocks,so it trades a headed hang for silently losing DOM capture on exactly the pages
most likely to be real applications. Fetching the collector from the backend has
the same CSP exposure, and the JS service starts no backend in trace mode. A
preload script's body bypasses page CSP; anything evaluated from a string does
not. So the only route with no downside is to register less code.
What the bundle is
Why the two big ones are there, and why they need not be
parse5 serves a round trip the page does not need.
parseDocumentreadsnode.outerHTML, serialising the live DOM to a string, then parses that stringback into a tree. The collector is already standing in the document. Walking the
nodes directly produces the same tree without the serialize/parse pair, and is
strictly cheaper at capture time as well.
preact/htm builds vnodes the app does not consume as vnodes.
transforminpackages/appreads the wire shape and callsh()itself, so the page side onlyhas to emit plain
{ type, props }objects.Removing both takes the preload from 213 KB to roughly 18 KB, which the #403
bisect measures at baseline navigation cost.
Acceptance criteria
The page bundle registers well under 50 KB. DOM capture, replay and the A11y
tab are unchanged across all four adapters, verified on the examples rather than
by unit tests alone, since this is the fidelity-critical path. #403's headed
reproduction passes.
Size: L. The serializer is delicate and shared by every adapter, so this wants
its own verification pass rather than riding along with another change.