perf(vom): avoid repeated sibling scans for duplicate action labels - #271
Merged
Merged
Conversation
lyingbug
marked this pull request as ready for review
September 17, 2026 09:38
iuyo5678
approved these changes
Sep 18, 2026
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a page contains many repeated action buttons in the same container,
collectSameContainerContextscans the preceding siblings again for every button. A flat list ofRecord Nlabels andOpenbuttons therefore performs quadratic context work, even though each handle retains at most three candidate labels.Change
Cache sibling-prefix progress for each parent during one render, keyed by context scope, target name, and incoming labels. Reuse the prefix when later handles request compatible context, and restart if traversal asks for an earlier prefix. Limit retained variants to 64 per parent. This preserves the existing label selection and frame-scope rules.
Add work-count regressions at 100, 600, and 2,000 actions, assert every resulting handle context, and run the VOM suite in CI. This PR is independent of the downstream browser, gateway, and session patches.
Measured effect
Local Node 20.20.0 measurements against
75e2c64, using the same flat-list fixture as the regression: three warm-up renders per implementation, then nine alternating timed renders; values below are medians. The complete render outputs matched.These are synthetic renderer measurements, not end-to-end browser timings. The largest benefit is for repeated actions sharing sibling context; unrelated page shapes need not see the same speedup. CI asserts work counts rather than machine-dependent timings.
Validation
pnpm lintpassed, including plugin type checking and 240 plugin tests.git diff --checkpassed. Live-browser tests were not run.