LearnNewsExamplesServices
Frontmatter
id9424
titleOptimize `cellPoolSize` calculation in `grid.Body` to prevent DOM waste
stateClosed
labels
enhancementperformancecoregrid
assigneestobiu
createdAtMar 9, 2026, 9:03 PM
updatedAtMar 9, 2026, 9:05 PM
githubUrlhttps://github.com/neomjs/neo/issues/9424
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 9, 2026, 9:05 PM

Optimize cellPoolSize calculation in grid.Body to prevent DOM waste

Closed v12.1.0 enhancementperformancecoregrid
tobiu
tobiu commented on Mar 9, 2026, 9:03 PM

Goal

To dynamically calculate the exact required cellPoolSize in Neo.grid.Body based on visible columns and buffer range, rather than relying on a hardcoded default that wastes DOM elements in small grids.

Context

Currently, Neo.grid.Body sets cellPoolSize_: 20 by default. In updateMountedAndVisibleColumns(), the pool only ever grows (by +5) if the visible columns exceed the pool size. This means a simple grid with only 3 columns still generates and manages 20 cells per row in the DOM, which is a massive waste of VDOM generation and reconciliation resources when horizontal scrolling isn't even active.

Requirements

  1. Change the default cellPoolSize_ to null.
  2. Update updateMountedAndVisibleColumns() to calculate the exact newPoolSize as endIndex - startIndex + 1.
  3. Ensure the state is updated accurately if the new pool size differs from the current pool size, allowing the grid to shrink its pool if the total column count or viewport width decreases.
tobiu assigned to @tobiu on Mar 9, 2026, 9:03 PM
tobiu added the enhancement label on Mar 9, 2026, 9:03 PM
tobiu added the performance label on Mar 9, 2026, 9:03 PM
tobiu added the core label on Mar 9, 2026, 9:03 PM
tobiu added the grid label on Mar 9, 2026, 9:03 PM
tobiu referenced in commit e4759c3 - "perf(grid): Optimize dynamic cellPoolSize calculation (#9424) on Mar 9, 2026, 9:04 PM
tobiu
tobiu Mar 9, 2026, 9:05 PM

Input from Gemini 3.1 Pro:

✦ The hardcoded cellPoolSize_: 20 default has been changed to null, and updateMountedAndVisibleColumns now dynamically calculates the exact pool size required based on the total width/count of the mounted columns.

This prevents massive DOM bloat in simple grids (e.g. rendering 3 actual cells and 17 hidden pool cells).

Fix has been committed and pushed. Closing as complete.

tobiu closed this issue on Mar 9, 2026, 9:05 PM