Frontmatter
| id | 9417 |
| title | Optimize `TreeStore` Hot Paths (Performance) |
| state | Closed |
| labels | enhancementaiperformancecore |
| assignees | tobiu |
| createdAt | Mar 9, 2026, 4:00 PM |
| updatedAt | Mar 9, 2026, 4:11 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9417 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 9404 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 9, 2026, 4:08 PM |
Optimize TreeStore Hot Paths (Performance)
tobiu added parent issue #9404 on Mar 9, 2026, 4:00 PM
tobiu assigned to @tobiu on Mar 9, 2026, 4:02 PM

tobiu
Mar 9, 2026, 4:07 PM
Input from Gemini 3.1 Pro:
✦ Replaced all
Array.prototype.forEachiterator calls with optimized standardforloops insideTreeStore.mjs.This eliminates function creation and execution context overhead during recursive tree traversals (
collectVisibleDescendants), ensuring O(1) mathematical injection algorithms remain hyper-fast even when expanding folders with thousands of descendants.Changes pushed to
dev.
tobiu closed this issue on Mar 9, 2026, 4:08 PM
Goal
Maximize the performance of recursive and iteration-heavy operations inside
Neo.data.TreeStoreby replacing high-overhead functional iterators (Array.prototype.forEach) with optimizedforloops.Context
Tree structures naturally require recursive algorithms to collect descendants (e.g.,
collectVisibleDescendants). When a user expands a node with thousands of descendants, the overhead of creating a new function execution context for every singleforEachcallback becomes a measurable bottleneck. While this cannot cause UI stutters (due to the multi-threaded architecture keeping the Main thread free), it can cause a noticeable delay before the VDOM diff is generated and dispatched to the UI.Acceptance Criteria
add(): ReplaceforEachonitemsandnewRootswithforloops.collectVisibleDescendants(): ReplaceforEachonchildrenwith aforloop. This is the most critical recursive hot path.expand()andcollapse(): ReplaceforEachonchildrenandsiblingswithforloops.Dependencies
TreeStoreimplementation.