LearnNewsExamplesServices
Frontmatter
id8989
titleperf: Implement atomic Grid Body updates via explicit suspension flag
stateClosed
labels
enhancementaiperformancecore
assigneestobiu
createdAtFeb 4, 2026, 7:46 PM
updatedAtFeb 4, 2026, 8:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/8989
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 4, 2026, 8:19 PM

perf: Implement atomic Grid Body updates via explicit suspension flag

Closed v12.0.0 enhancementaiperformancecore
tobiu
tobiu commented on Feb 4, 2026, 7:46 PM

Context

Changing multiple configs that affect the view (e.g., scrollLeft and scrollTop during diagonal scrolling) triggers multiple createViewData -> update calls in the same tick.

Solution

  1. ScrollManager: Consolidate the DOM updates into a single, atomic operation using syncGridBody.
  2. Grid Body: Implement a skipCreateViewData flag guard in createViewData.

Changes

  1. Refactor ScrollManager:
    • Create syncGridBody (throttle: 16ms) in delayable.
    • Update onBodyScroll and onContainerScroll to update local state and call me.syncGridBody().
    • Implement syncGridBody to use the suspend/resume pattern:
              this.gridBody.skipCreateViewData = true;
      this.gridBody.set({scrollLeft, scrollTop});
      this.gridBody.skipCreateViewData = false;
      this.gridBody.createViewData();
  2. Modify Grid Body:
    • Add if (me.skipCreateViewData) return; to createViewData.

Expected Result

Smoother diagonal scrolling and reduced update() cycles on the Grid Body, without the latency of buffering.

tobiu added the enhancement label on Feb 4, 2026, 7:46 PM
tobiu added the performance label on Feb 4, 2026, 7:46 PM
tobiu added the core label on Feb 4, 2026, 7:46 PM
tobiu assigned to @tobiu on Feb 4, 2026, 7:46 PM
tobiu changed title from perf: Buffer createViewData in grid.Body to coalesce updates to perf: Implement atomic Grid Body updates via explicit suspension flag on Feb 4, 2026, 7:51 PM
tobiu referenced in commit 2892f7e - "perf: Implement atomic Grid Body updates via explicit suspension flag (#8989)" on Feb 4, 2026, 8:17 PM
tobiu
tobiu Feb 4, 2026, 8:17 PM

Input from Gemini 3 Pro:

✦ Implemented atomic Grid Body updates to optimize diagonal scrolling.

Changes:

  1. Refactored ScrollManager:
    • Added syncGridBody to delayable (throttled 16ms).
    • Refactored onBodyScroll and onContainerScroll to update local state (scrollTop/scrollLeft) and trigger syncGridBody immediately (removed their own throttles to prevent message queue flooding/latency mismatch).
    • Implemented syncGridBody using the suspend/resume pattern via skipCreateViewData to ensure atomic application of both coordinates.
  2. Modified GridBody:
    • Added if (me.skipCreateViewData) return; guard to createViewData to support the suspension pattern.

This ensures that simultaneous X and Y scroll events result in a single, synchronized VDOM update cycle.

tobiu added the ai label on Feb 4, 2026, 8:18 PM
tobiu closed this issue on Feb 4, 2026, 8:19 PM