You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make DocumentFragment attachment atomic and avoid repeated recascade #92
Node.appendChild(DocumentFragment) currently transfers children one at a time and recascades both the child subtree and parent after every transfer. Structural selectors therefore see transient sibling lists, so earlier children can retain incorrect :last-child, :nth-child, :first-child, :empty, and :has() results. The repeated parent traversal is also a hot path when Code OSS constructs or replaces panels.
A focused regression produces widths [5px,5px,5px]; atomic attachment should produce [3px,4px,5px].
Proposed fix
Transfer the fragment's children first, recascade the connected parent subtree once against the completed tree, then activate stylesheets and enqueue resources. Keep a build-time control path so the old and new algorithms can be benchmarked from the same revision.
Acceptance gates
Direct native structural-selector regression passes.
WPT-style fragment attachment contract passes.
A deterministic A-B-B-A benchmark demonstrates at least 10% median improvement.
Full native/runtime and package CI remain green.
Packaged Code OSS visual, editor, and performance gates show no regression.
Current evidence
Six-block A-B-B-A measurement with seven measured and two warm-up iterations per run:
control median p50: 74.9825 ms
candidate median p50: 66.9720 ms
improvement: 10.683%
A cooler four-block run measured 42.360 ms to 35.724 ms, a 15.666% improvement. The candidate direct regression and WPT contract pass; the control fails both the exact selector result and the WPT assertion.
Focused PR #93 is now at 90cfc41c and remains draft/open.
The regression coverage now checks connected fragment attachment across a pre-existing sibling, including adjacent-sibling, :nth-child, and :last-child invalidation in both the WPT-style contract and native regression. The focused WPT passes 2/2 assertions.
End-to-end Code OSS qualification on the consolidated implementation also passes:
exact workbench geometry parity against original Code OSS at 1440x940;
mean absolute pixel error 0.004786 and changed-pixel ratio 0.009337;
CSS recascade p95 0.337 ms and layout p95 0.698 ms;
deterministic 10 x 256-child panel attach/detach p95 8.637/0.824 ms;
visible idle CPU mean 0.866%.
The A-B-B-A focused benchmark remains 74.9825 ms control to 66.9720 ms candidate (10.683% improvement). Exact-head runtime-package CI is running at https://github.com/SceneTech/WebScene/actions/runs/35033282145. Keep this issue and PR draft until that package matrix is green.
Activity
wieslawsoltes commentedon Sep 15, 2026
Focused PR #93 is now at
90cfc41cand remains draft/open.The regression coverage now checks connected fragment attachment across a pre-existing sibling, including adjacent-sibling,
:nth-child, and:last-childinvalidation in both the WPT-style contract and native regression. The focused WPT passes 2/2 assertions.End-to-end Code OSS qualification on the consolidated implementation also passes:
The A-B-B-A focused benchmark remains 74.9825 ms control to 66.9720 ms candidate (10.683% improvement). Exact-head runtime-package CI is running at https://github.com/SceneTech/WebScene/actions/runs/35033282145. Keep this issue and PR draft until that package matrix is green.