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
blockedBy[]
blocking[]
closedAtMar 11, 2026, 11:03 AM

TreeStore: Optimize #allRecordsMap iteration loops

Closed v12.1.0 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 added the enhancement label on Mar 11, 2026, 10:59 AM
tobiu added the ai label on Mar 11, 2026, 10:59 AM
tobiu added the performance label on Mar 11, 2026, 10:59 AM
tobiu added the grid label on Mar 11, 2026, 10:59 AM
tobiu added parent issue #9404 on Mar 11, 2026, 11:00 AM
tobiu assigned to @tobiu on Mar 11, 2026, 11:00 AM
tobiu referenced in commit 3250cdd - "perf(data.TreeStore): Optimize #allRecordsMap iteration loops (#9437)" on Mar 11, 2026, 11:02 AM
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!

tobiu closed this issue on Mar 11, 2026, 11:03 AM