Context
Following the neo.mjs@13.3.1 vs ag-grid-community@36.2.0 (animateRows={false}, vite preview) benchmark update in neomjs/benchmarks#3, a line-by-line V-B-A audit of src/grid/Row.mjs, src/grid/Container.mjs, src/grid/header/Wrapper.mjs, src/collection/Base.mjs, src/data/Store.mjs, and examples/grid/bigData/ surfaced seven concrete hot-path bottlenecks during 100k-row × 200-column dataset swaps, filtering, and 2D virtual scrolling.
- Live latest-open sweep (
ticket-create §1a(i)): Checked latest 20 open issues on neomjs/neo (#20114 down to #19139) at 2026-10-26T01:01:28Z; no equivalent found.
- A2A in-flight claim sweep (
ticket-create §1a(ii)): Checked list_messages({status: 'all', limit: 30}) at 2026-10-26T01:01:14Z; no overlapping [lane-claim] or [lane-intent] on src/grid/*, src/collection/*, or examples/grid/bigData/*.
- Memory Core & KB rationale sweep (
ticket-create §1a(iii)-(iv)): Ran query_raw_memories (grid Row createVdom permanent columns collection splice isFilteredItem evaluateFilters bigData performance), ask_knowledge_base, and gh issue list --state open --assignee @me (0 open issues); no prior retraction or duplicate found.
The Problem
- Unconditional
O(rows × totalColumns) Pass-2 permanent-column loop in Neo.grid.Row#createVdom (src/grid/Row.mjs:564-588):
On every vertical or horizontal scroll frame and every store load, Pass 2 executes for (i = 0; i < countColumns; i++) on every visible row, calling columnPositions.getAt(i) and columns.get(columnPosition.dataField) 200 times per row (30 rows × 200 columns = 6,000 lookups per frame) to check if (column.hideMode !== 'removeDom' || column.locked) — even when zero columns in the grid use permanent mode or locking.
- Non-silent
clear() + add() inside Neo.grid.Container#createColumns (src/grid/Container.mjs:962-973) and leaked header.Button instances in Neo.grid.header.Wrapper#updateHeaders (src/grid/header/Wrapper.mjs:216-239):
When grid.columns = newColumns is assigned at runtime (me._columns is already a Collection with listeners: {mutate: me.onColumnsMutate}), line 963 calls me._columns.clear() (firing onColumnsMutate #1 with 0 columns, running createOrUpdateSubGrids() and a passSizeToBody() main-thread getLayoutRect IPC round-trip), line 964 calls me._columns.add(columns) (firing onColumnsMutate #2, running a second createOrUpdateSubGrids(), second passSizeToBody() IPC round-trip, and applyColumnButtonOrder() across 200 columns), and line 970 then calls me.createOrUpdateSubGrids(lockedStartButtons, centerButtons, lockedEndButtons) a third time. Furthermore, Wrapper#updateHeaders overwrites headerToolbar.items = centerButtons without destroying the previous Neo.grid.header.Button instances.
- Redundant render passes in
examples/grid/bigData/GridContainer.mjs (lines 78-80) and MainStore.mjs (lines 93-129):
GridContainer#afterSetAmountColumns sets this.store.amountColumns = value before this.columns = columns, causing GridBody to render the newly generated 200-column records against the old 50 columns before rebuilding the 200 columns. In addition, MainStore calls me.clear(false) followed by me.add(data, false), firing two separate mutate → load cycles (the first rendering an empty grid and arming a 50ms scrollTo timer).
- 100,000
isFilteredItem invocations during bulk Collection#splice when no filter is effective (src/collection/Base.mjs:1597-1630, src/data/Store.mjs:1091-1107):
MainStore configures two inactive filters (firstname: null, lastname: null). During store.add(data, false) for 100,000 items, Collection#splice calls !me.isFilteredItem(item) 100,000 times (Store#isFilteredItem iterating me.filters.forEach 100,000 times and Collection#isFilteredItem calling Filter#isFiltered 200,000 times) even though me._filters.some(f => f.effective) is false.
- Unconditional
items.slice() of 100,000 items in Collection#evaluateFilters (src/collection/Base.mjs:1161):
let filtered = items.slice() clones the 100,000-element array unconditionally right before if (this.filterMode === 'primitive') { filtered = []; } discards the clone.
- Per-cell
getLogicalCellId string allocation and selectedCells.includes() in Row#applyRendererOutput (src/grid/Row.mjs:302, 467):
Because selectedCells defaults to [] (Row.mjs:422), if (selectedCells) is always truthy, allocating logicalCellId and calling .includes() on every rendered cell even when selectedCells.length === 0.
The Architectural Reality
Neo.collection.Filter already exposes a canonical get effective() getter (src/collection/Filter.mjs:115-118: !me.disabled && (!!me.filterBy || !(me.includeEmptyValues && (me.value === null || Neo.isEmpty(me.value))))).
Neo.grid.Container#onColumnLockChange (src/grid/Container.mjs:1209) already uses clearSilent() to avoid double-firing onColumnsMutate.
The Fix
src/grid/Row.mjs & src/grid/Body.mjs:
- Guard Pass 2 in
Row#createVdom so it only iterates when the grid has permanent (hideMode !== 'removeDom') or locked columns (or iterate a pre-filtered list of permanent column indices).
- Guard
if (selectedCells?.length > 0) (at Row.mjs:302) and if (selectedRows?.length > 0 && record) (at Row.mjs:467) before computing logicalCellId or calling .includes().
src/grid/Container.mjs & src/grid/header/Wrapper.mjs:
- In
Container#createColumns (src/grid/Container.mjs:962-973), destroy replaced column instances and update me._columns without triggering two premature onColumnsMutate passes before createOrUpdateSubGrids(lockedStartButtons, centerButtons, lockedEndButtons).
- In
Wrapper#updateHeaders (src/grid/header/Wrapper.mjs:216-239), destroy replaced Neo.grid.header.Button instances before assigning new button configs to items and calling createItems().
src/collection/Base.mjs & src/data/Store.mjs:
- In
Collection#splice (src/collection/Base.mjs:1597-1630), compute const hasEffectiveFilters = me._filters.some(f => f.effective) once before the for (i = 0; i < len; i++) loop and only call me.isFilteredItem(item) when hasEffectiveFilters is true.
- In
Collection#evaluateFilters (src/collection/Base.mjs:1161), only call items.slice() in the non-primitive branch.
examples/grid/bigData/GridContainer.mjs & MainStore.mjs:
- Use
me.clearSilent() (and me.allItems?.clearSilent()) before me.add(data, false) in MainStore so dataset swaps emit a single mutate → load event.
- Coordinate
GridContainer#afterSetAmountColumns so column definitions and store data update without rendering the new dataset against stale columns first.
Decision Record impact
none — preserves all existing Neo.grid, Neo.collection, and Neo.data.Store contracts and event semantics while eliminating redundant work in hot paths.
Acceptance Criteria
Out of Scope
- Changing
Neo.data.Store#initialChunkSize defaults globally.
- Benchmark suite changes in
neomjs/benchmarks (tracked separately in neomjs/benchmarks).
Related
Origin Session ID: 74232d92-30de-45ab-ab3d-4579227f3b4b
Retrieval Hint: "Optimize grid.Row grid.Container collection.Base bigData hot paths Pass 2 permanent columns Filter effective"
Context
Following the
neo.mjs@13.3.1vsag-grid-community@36.2.0(animateRows={false},vite preview) benchmark update inneomjs/benchmarks#3, a line-by-line V-B-A audit ofsrc/grid/Row.mjs,src/grid/Container.mjs,src/grid/header/Wrapper.mjs,src/collection/Base.mjs,src/data/Store.mjs, andexamples/grid/bigData/surfaced seven concrete hot-path bottlenecks during 100k-row × 200-column dataset swaps, filtering, and 2D virtual scrolling.ticket-create §1a(i)): Checked latest 20 open issues onneomjs/neo(#20114down to#19139) at2026-10-26T01:01:28Z; no equivalent found.ticket-create §1a(ii)): Checkedlist_messages({status: 'all', limit: 30})at2026-10-26T01:01:14Z; no overlapping[lane-claim]or[lane-intent]onsrc/grid/*,src/collection/*, orexamples/grid/bigData/*.ticket-create §1a(iii)-(iv)): Ranquery_raw_memories(grid Row createVdom permanent columns collection splice isFilteredItem evaluateFilters bigData performance),ask_knowledge_base, andgh issue list --state open --assignee @me(0open issues); no prior retraction or duplicate found.The Problem
O(rows × totalColumns)Pass-2 permanent-column loop inNeo.grid.Row#createVdom(src/grid/Row.mjs:564-588): On every vertical or horizontal scroll frame and every store load, Pass 2 executesfor (i = 0; i < countColumns; i++)on every visible row, callingcolumnPositions.getAt(i)andcolumns.get(columnPosition.dataField)200times per row (30 rows × 200 columns = 6,000lookups per frame) to checkif (column.hideMode !== 'removeDom' || column.locked)— even when zero columns in the grid use permanent mode or locking.clear()+add()insideNeo.grid.Container#createColumns(src/grid/Container.mjs:962-973) and leakedheader.Buttoninstances inNeo.grid.header.Wrapper#updateHeaders(src/grid/header/Wrapper.mjs:216-239): Whengrid.columns = newColumnsis assigned at runtime (me._columnsis already aCollectionwithlisteners: {mutate: me.onColumnsMutate}), line963callsme._columns.clear()(firingonColumnsMutate#1 with 0 columns, runningcreateOrUpdateSubGrids()and apassSizeToBody()main-threadgetLayoutRectIPC round-trip), line964callsme._columns.add(columns)(firingonColumnsMutate#2, running a secondcreateOrUpdateSubGrids(), secondpassSizeToBody()IPC round-trip, andapplyColumnButtonOrder()across 200 columns), and line970then callsme.createOrUpdateSubGrids(lockedStartButtons, centerButtons, lockedEndButtons)a third time. Furthermore,Wrapper#updateHeadersoverwritesheaderToolbar.items = centerButtonswithout destroying the previousNeo.grid.header.Buttoninstances.examples/grid/bigData/GridContainer.mjs(lines 78-80) andMainStore.mjs(lines 93-129):GridContainer#afterSetAmountColumnssetsthis.store.amountColumns = valuebeforethis.columns = columns, causingGridBodyto render the newly generated 200-column records against the old 50 columns before rebuilding the 200 columns. In addition,MainStorecallsme.clear(false)followed byme.add(data, false), firing two separatemutate→loadcycles (the first rendering an empty grid and arming a50msscrollTotimer).isFilteredIteminvocations during bulkCollection#splicewhen no filter iseffective(src/collection/Base.mjs:1597-1630,src/data/Store.mjs:1091-1107):MainStoreconfigures two inactive filters (firstname: null,lastname: null). Duringstore.add(data, false)for 100,000 items,Collection#splicecalls!me.isFilteredItem(item)100,000 times (Store#isFilteredItemiteratingme.filters.forEach100,000 times andCollection#isFilteredItemcallingFilter#isFiltered200,000 times) even thoughme._filters.some(f => f.effective)isfalse.items.slice()of 100,000 items inCollection#evaluateFilters(src/collection/Base.mjs:1161):let filtered = items.slice()clones the 100,000-element array unconditionally right beforeif (this.filterMode === 'primitive') { filtered = []; }discards the clone.getLogicalCellIdstring allocation andselectedCells.includes()inRow#applyRendererOutput(src/grid/Row.mjs:302, 467): BecauseselectedCellsdefaults to[](Row.mjs:422),if (selectedCells)is always truthy, allocatinglogicalCellIdand calling.includes()on every rendered cell even whenselectedCells.length === 0.The Architectural Reality
Neo.collection.Filteralready exposes a canonicalget effective()getter (src/collection/Filter.mjs:115-118:!me.disabled && (!!me.filterBy || !(me.includeEmptyValues && (me.value === null || Neo.isEmpty(me.value))))).Neo.grid.Container#onColumnLockChange(src/grid/Container.mjs:1209) already usesclearSilent()to avoid double-firingonColumnsMutate.The Fix
src/grid/Row.mjs&src/grid/Body.mjs:Row#createVdomso it only iterates when the grid has permanent (hideMode !== 'removeDom') or locked columns (or iterate a pre-filtered list of permanent column indices).if (selectedCells?.length > 0)(atRow.mjs:302) andif (selectedRows?.length > 0 && record)(atRow.mjs:467) before computinglogicalCellIdor calling.includes().src/grid/Container.mjs&src/grid/header/Wrapper.mjs:Container#createColumns(src/grid/Container.mjs:962-973), destroy replaced column instances and updateme._columnswithout triggering two prematureonColumnsMutatepasses beforecreateOrUpdateSubGrids(lockedStartButtons, centerButtons, lockedEndButtons).Wrapper#updateHeaders(src/grid/header/Wrapper.mjs:216-239), destroy replacedNeo.grid.header.Buttoninstances before assigning new button configs toitemsand callingcreateItems().src/collection/Base.mjs&src/data/Store.mjs:Collection#splice(src/collection/Base.mjs:1597-1630), computeconst hasEffectiveFilters = me._filters.some(f => f.effective)once before thefor (i = 0; i < len; i++)loop and only callme.isFilteredItem(item)whenhasEffectiveFiltersis true.Collection#evaluateFilters(src/collection/Base.mjs:1161), only callitems.slice()in the non-primitivebranch.examples/grid/bigData/GridContainer.mjs&MainStore.mjs:me.clearSilent()(andme.allItems?.clearSilent()) beforeme.add(data, false)inMainStoreso dataset swaps emit a singlemutate→loadevent.GridContainer#afterSetAmountColumnsso column definitions and store data update without rendering the new dataset against stale columns first.Decision Record impact
none— preserves all existingNeo.grid,Neo.collection, andNeo.data.Storecontracts and event semantics while eliminating redundant work in hot paths.Acceptance Criteria
Neo.grid.Row#createVdomskips Pass 2'sO(countColumns)loop when no column hashideMode !== 'removeDom'orlocked, while preserving permanent/locked cell rendering when present.Neo.grid.Row#applyRendererOutputandcreateVdomskipgetLogicalCellIdand.includes()whenselectedCells/selectedRowsis empty.Neo.grid.Container#createColumnsandNeo.grid.header.Wrapper#updateHeadersavoid redundantonColumnsMutatepasses and destroy replaced column / header button instances on runtimegrid.columns = ...reassignment.Neo.collection.Base#splicechecksme._filters.some(f => f.effective)once before the item loop, skipping per-itemisFilteredItemcalls when no filter is effective.Neo.collection.Base#evaluateFiltersavoids cloningitems.slice()whenthis.filterMode === 'primitive'.examples/grid/bigData/GridContainer.mjsandMainStore.mjsavoid redundant intermediateclear(false)and stale-column render passes on row/column count changes.npx playwright test --config buildScripts/playwright/playwright.config.unit.mjs).Out of Scope
Neo.data.Store#initialChunkSizedefaults globally.neomjs/benchmarks(tracked separately inneomjs/benchmarks).Related
neomjs/benchmarks#3Origin Session ID: 74232d92-30de-45ab-ab3d-4579227f3b4b Retrieval Hint: "Optimize grid.Row grid.Container collection.Base bigData hot paths Pass 2 permanent columns Filter effective"