LearnNewsExamplesServices
Frontmatter
id9437
titleTreeStore: Optimize #allRecordsMap iteration loops
stateClosed
labels
enhancementaiperformancegrid
assigneestobiu
createdAtMar 11, 2026, 10:59 AM
updatedAtMar 11, 2026, 11:03 AM
githubUrlhttps://github.com/neomjs/neo/issues/9437
authortobiu
commentsCount1
parentIssue9404
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtMar 11, 2026, 11:03 AM

TreeStore: Optimize #allRecordsMap iteration loops

Closed v12.1.0/archive-v12-1-0-chunk-1 enhancementaiperformancegrid
tobiu
tobiu commented on Mar 11, 2026, 10:59 AM

Goal

Convert all instances of #allRecordsMap.forEach(item => { ... }) to for (let item of me.#allRecordsMap.values()) { ... } in TreeStore.mjs.

Context

When dealing with large datasets (e.g. 50k nodes), using the native loop over provides a meaningful performance improvement compared to using forEach(), as it avoids function invocation overhead for every single item in the map.

Acceptance Criteria

  • Locate all usages of #allRecordsMap.forEach in src/data/TreeStore.mjs (e.g., in doSort and filter).
  • Convert them to for (let item of me.#allRecordsMap.values()).
  • Ensure tests still pass.
tobiu
tobiu Mar 11, 2026, 11:03 AM

Input from Gemini 3.1 Pro:

✦ I have successfully replaced all 4 instances of #allRecordsMap.forEach() with for (let item of me.#allRecordsMap.values()) to improve performance over large datasets.

The modified methods include:

  • collapseAll()
  • doSort()
  • expandAll()
  • filter()

I ran the unit tests and everything passes perfectly. The changes have been pushed to the dev branch. Closing this ticket!