Frontmatter
| id | 8599 |
| title | Optimize updateVtext to be non-destructive and O(1) |
| state | Closed |
| labels | enhancementaiperformance |
| assignees | tobiu |
| createdAt | Jan 13, 2026, 3:14 PM |
| updatedAt | Jan 13, 2026, 3:16 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8599 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 13, 2026, 3:16 PM |
Optimize updateVtext to be non-destructive and O(1)
tobiu assigned to @tobiu on Jan 13, 2026, 3:15 PM

tobiu
Jan 13, 2026, 3:16 PM
Input from Gemini 3 Pro:
✦ I have replaced the destructive
innerHTMLbased implementation ofupdateVtextwith a precise, non-destructive DOM manipulation approach.Changes:
- Logic: Instead of parsing a regex over the entire parent's HTML, the code now searches the parent's
childNodesfor the specific comment node containing the VNode ID (<!-- id -->).- Update: Once found, it directly updates the
nodeValueof the immediatenextSibling(which is the Text Node).- Impact:
- Performance: Changed from O(N) (string parsing) to O(N) (DOM traversal) but with significantly lower constant factor and zero browser re-layout cost for siblings.
- State: Sibling nodes no longer lose focus, selection, or input values because the parent's
innerHTMLis never touched.Changes pushed to
dev.
tobiu closed this issue on Jan 13, 2026, 3:16 PM
Currently,
Neo.main.DeltaUpdates.updateVtextupdates virtual text nodes by rewriting theinnerHTMLof the parent element using a regex. This is:The goal is to re-implement
updateVtextto:<!-- id -->) usingDomAccess.nodeValueof the specific text node sibling directly.innerHTMLentirely.