Skip to content

Hot-loop performance: StoreValidator, GridFindField, and selection sync - #4602

Open
lbwexler wants to merge 2 commits into
developfrom
hot-loop-perf-2
Open

Hot-loop performance: StoreValidator, GridFindField, and selection sync#4602
lbwexler wants to merge 2 commits into
developfrom
hot-loop-perf-2

Conversation

@lbwexler

Copy link
Copy Markdown
Member

Stacked on #4600 - second batch of hot-path fixes, split out for reviewability. Will re-target to develop automatically when #4600 merges.

  • StoreValidator: no longer syncs on every transaction of a clean store - uncommittedRecords returns a shared EMPTY constant when clean (reference equality keeps its reaction quiet), and the tracked value feeds the run directly, removing a duplicate O(n) scan when dirty.
  • GridFindField: data reaction debounced with queryBuffer; result sorting decorates once per record (value + ag-Grid node) instead of resolving per comparison, with sorter setup (incl. getAgSpec()) hoisted out of the tree recursion. Also stops mutating record children arrays in place.
  • Selection sync: AgGridModel.setSelectedRowNodeIds() applies the selection delta in at most two bulk setNodesSelected() calls - unchanged rows untouched, and select-all no longer fires an event per row. Grid tracks selectedIds, now computed independently of selectedRecords so identity-only observers skip that computed's structural compare over record contents (public observable semantics unchanged - selectedIds was already documented identity-only). Includes a correctness fix: cullSelectionReaction was mutating the observable.ref ids array in place, so culls never notified observers - now reassigns.

Validated in Toolbox: GridFindField query/cycle/reload on the tree grid, select-random + scroll-to-selection, and inline-edit validation incl. the dirty→clean transition. Zero console errors.

* StoreValidator no longer syncs on every transaction of a clean store - uncommittedRecords returns a shared EMPTY constant when clean, preserving reference equality for its reaction; the tracked value is passed into the run, killing a duplicate O(n) scan when dirty.
* GridFindField: data reaction now debounced with queryBuffer; result sorting uses decorate-sort-undecorate so values and ag-Grid nodes resolve once per record instead of per comparison, and sorter setup (incl. getAgSpec) is hoisted out of the tree recursion. No longer mutates record children arrays in place.
* AgGridModel.setSelectedRowNodeIds applies the selection delta in at most two bulk setNodesSelected calls - unchanged rows are untouched, and select-all on a large grid no longer fires an event per row.
* Grid selection sync tracks StoreSelectionModel.selectedIds, now computed independently of selectedRecords so identity-only observers skip that computed's structural compare over record contents. Fixed cullSelectionReaction silently mutating the observable.ref ids array in place - culls now notify observers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant