LearnNewsExamplesServices
Frontmatter
id8832
titleEnhancement: Implement Sparse Tree Generation for VDOM Updates
stateClosed
labels
enhancementaiperformancecore
assigneestobiu
createdAtJan 20, 2026, 7:18 PM
updatedAtJan 20, 2026, 7:27 PM
githubUrlhttps://github.com/neomjs/neo/issues/8832
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 20, 2026, 7:27 PM

Enhancement: Implement Sparse Tree Generation for VDOM Updates

Closed v11.23.0 enhancementaiperformancecore
tobiu
tobiu commented on Jan 20, 2026, 7:18 PM

Current VDOM update logic using updateDepth can lead to inefficient "wasteful expansion" of clean subtrees. When a parent updates with updateDepth: 2 (or greater), all children at that depth are expanded, even if they have no changes.

This ticket aims to implement "Sparse Tree Generation" in Neo.util.vdom.TreeBuilder.

Goals:

  1. Selective Expansion: Only expand branches that lead to "dirty" components (merged updates) or are dirty themselves.
  2. Pruning: "Clean" siblings that are not part of the update path should be sent as placeholders (pruned), effectively excluding them from the parent's update transaction.
  3. Parallelism: By pruning clean siblings, they remain free to execute their own independent updates in parallel, resolving the "Blocked Sibling" concurrency issue.
  4. Verification: Add unit tests to prove that clean siblings are pruned when updateDepth allows for deeper traversal.

Tasks:

  • Create a failing test case demonstrating current "wasteful expansion".
  • Enhance VDomUpdate.mjs to track "Bridge Paths" (ancestors that must be expanded to reach a merged child).
  • Update TreeBuilder.mjs to use this bridge logic for conditional expansion.
  • Verify that clean siblings are pruned and can update in parallel.
tobiu added the enhancement label on Jan 20, 2026, 7:18 PM
tobiu added the ai label on Jan 20, 2026, 7:18 PM
tobiu added the performance label on Jan 20, 2026, 7:18 PM
tobiu added the core label on Jan 20, 2026, 7:18 PM
tobiu assigned to @tobiu on Jan 20, 2026, 7:18 PM
tobiu referenced in commit 274b9f5 - "enhancement: Implement Sparse Tree Generation for VDOM Updates (#8832) on Jan 20, 2026, 7:27 PM
tobiu
tobiu Jan 20, 2026, 7:27 PM

Input from Gemini 3 Pro:

✦ I have implemented Sparse Tree Generation.

Changes:

  1. VDomUpdate.mjs: Modified getMergedChildIds to calculate and include "Bridge Paths". It now returns a Set containing not just the merged children, but all intermediate ancestors required to reach them.
  2. TreeBuilder.mjs: Enhanced expansion logic. If a mergedChildIds AllowList is present, it now prunes (sends as placeholder) any branch that is not in the list, even if updateDepth would otherwise allow expansion.
  3. SparseUpdates.spec.mjs: Added a new unit test proving that clean siblings are pruned (sent as placeholders with no tag) during a merged update cycle.

Result: Verified that updateDepth: 2 (or greater) no longer causes "wasteful expansion" of clean subtrees. The VDOM worker receives a truly sparse tree containing only the necessary updates and the bridges to reach them. All existing VDOM tests pass.

tobiu closed this issue on Jan 20, 2026, 7:27 PM
tobiu cross-referenced by #8833 on Jan 20, 2026, 7:35 PM