LearnNewsExamplesServices
Frontmatter
id9474
titleGrid: Optimize row pooling for small datasets
stateClosed
labels
enhancementaiperformancegrid
assigneestobiu
createdAtMar 14, 2026, 1:07 PM
updatedAtMar 14, 2026, 1:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/9474
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 14, 2026, 1:08 PM

Grid: Optimize row pooling for small datasets

Closed v12.1.0 enhancementaiperformancegrid
tobiu
tobiu commented on Mar 14, 2026, 1:07 PM

The Grid's Body component previously calculated its row pool size strictly based on the visible viewport height plus the bufferRowRange (availableRows + 2 * bufferRowRange).

For small datasets (e.g., 9 records) displayed in a large viewport (e.g., capable of fitting 30+ rows), this caused the grid to unnecessarily instantiate and manage a large number of empty Neo.grid.Row components that would never receive data.

This optimization clamps the maximum pool size to the total number of records in the store (store.count), significantly reducing the initial VDOM generation and memory footprint for small grids while maintaining O(1) recycling performance for large datasets.

Changes:

  • Introduced a rowPoolSize class field in src/grid/Body.mjs.
  • Clamped the row pool generation to Math.min(windowSize, store.count).
  • Updated all internal ID generation (getRowId) to respect the dynamic pool size.
  • Migrated all deprecated store.getCount() calls to store.count within Body.mjs.
tobiu added the enhancement label on Mar 14, 2026, 1:07 PM
tobiu added the ai label on Mar 14, 2026, 1:07 PM
tobiu added the performance label on Mar 14, 2026, 1:07 PM
tobiu added the grid label on Mar 14, 2026, 1:07 PM
tobiu assigned to @tobiu on Mar 14, 2026, 1:08 PM
tobiu referenced in commit b0cca03 - "feat(grid): Optimize row pooling for small datasets (#9474)" on Mar 14, 2026, 1:08 PM
tobiu
tobiu Mar 14, 2026, 1:08 PM

Input from Gemini 3.1 Pro:

✦ I have successfully implemented the grid row pooling optimization:

  • Added the rowPoolSize class field in src/grid/Body.mjs instead of hijacking internal properties.
  • Updated createRowPool() to compute the needed size via Math.min(windowSize, store.count).
  • Replaced all deprecated store.getCount() occurrences with store.count.
  • Ensured getRowId() relies on the dynamic rowPoolSize for rowIndex % poolSize modulus calculation.

This effectively minimizes the initial VDOM generation for smaller grids without impacting performance on massive ones.

tobiu closed this issue on Mar 14, 2026, 1:08 PM
tobiu cross-referenced by #9475 on Mar 14, 2026, 1:34 PM