perf(replay): skip empty text child-list reads - #4812
Conversation
|
Replay incident risk checkThis diff touches code involved in past incidents. This is a heads-up, not a verdict: read the matched sections of INCIDENTS.md and answer their review questions before merging. For a judgment on whether this diff has the same failure mode, run the |
|
Size Change: +1.73 kB (+0.01%) Total Size: 20.5 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Reviews (1): Last reviewed commit: "perf(replay): skip empty text child-list..." | Re-trigger Greptile |
fasyy612
left a comment
There was a problem hiding this comment.
just a small nit, otherwise LGTM!
Problem
Repeated subtree moves make the recorder fetch empty child lists from text nodes many times. Text nodes cannot have children or shadow roots, so these reads do not discover any recording work.
This PR is stacked on #4811 and is another small, synchronous improvement for #4217. It does not resolve the remaining main-thread stalls.
Changes
genAddsanddeepDelete, after their normal classification and set updates.processRemoveswalk. The other test verifies that a global blocking regexp is still evaluated.Measurements
Approximately 50k nodes, 11 moves in one batch, compression enabled, Apple M4 Pro and Chromium 136.0.7103.25. Three alternating baseline/candidate runs per shape used identical harness source without profiling, counter instrumentation or concurrent builds/tests.
The observed reduction was roughly 2–3% for repeated moves and 4–6% for mixed moves. Individual runs overlap. These are descriptive samples, not evidence of statistical significance or typical customer impact. Startup and removal were effectively flat. The candidate still blocks for roughly 300–400 ms.
Separate diagnostics confirmed unchanged node visits and set operations at 10k nodes / 11 moves across all four shapes, including mixed moves. Recorder size increased by 63 raw bytes and 14 gzip bytes.
Full investigation and reproduction commands.
Validation and risk
f45416053617f752ca05de0dec7439e369e51228, usingautoreview --mode branch --base origin/perf/replay-move-preprocessing.The incident checker flagged serializer correctness. Blocking checks and set updates remain intact, and browser assertions cover intermediate replay state and privacy. Style serialization, lazy-load contracts, persisted state, session rotation and recording-volume policies are unchanged.
Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
posthog-jspatch changeset🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with Pi using Chromium profiling, diagnostic counters, Vitest, Playwright and isolated autoreview. The change only skips child discovery for text nodes. It does not skip their classification, blocking checks or serialization.
The investigation rejected geometry caching because the measured layout cost was mostly ordinary page work and stale geometry would break replay. Human review is required.