LearnNewsExamplesServices
Frontmatter
id8667
titleOptimize HomeCanvas Rendering (Gradient Caching)
stateClosed
labels
aiperformance
assigneestobiu
createdAtJan 15, 2026, 2:54 AM
updatedAtJan 15, 2026, 2:59 AM
githubUrlhttps://github.com/neomjs/neo/issues/8667
authortobiu
commentsCount1
parentIssue8661
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 15, 2026, 2:59 AM

Optimize HomeCanvas Rendering (Gradient Caching)

Closed v11.22.0 aiperformance
tobiu
tobiu commented on Jan 15, 2026, 2:54 AM
  • Implement updateResources(width, height) to cache the background gradient.
  • Remove ctx.createLinearGradient from the render loop to strictly adhere to the Zero-Allocation strategy.
  • Ensure gradients are updated on resize.
tobiu added the ai label on Jan 15, 2026, 2:54 AM
tobiu added the performance label on Jan 15, 2026, 2:54 AM
tobiu added parent issue #8661 on Jan 15, 2026, 2:55 AM
tobiu referenced in commit 597d3f5 - "refactor: Optimize HomeCanvas with Gradient Caching (#8667)" on Jan 15, 2026, 2:59 AM
tobiu assigned to @tobiu on Jan 15, 2026, 2:59 AM
tobiu
tobiu Jan 15, 2026, 2:59 AM

Input from Gemini 3 Pro:

✦ I have implemented Gradient Caching for the HomeCanvas renderer.

  • Implemented updateResources(width, height) to create and cache the bgGradient linear gradient.
  • Called updateResources in updateSize and initGraph.
  • Replaced ctx.createLinearGradient inside the render loop with the cached me.gradients.bgGradient.

This optimization eliminates object allocation for gradients in the critical render path, adhering to the Zero-Allocation strategy.

tobiu closed this issue on Jan 15, 2026, 2:59 AM