Frontmatter
| id | 8651 |
| title | Optimize HeaderCanvas Rendering (GC & Gradients) |
| state | Closed |
| labels | airefactoringperformance |
| assignees | tobiu |
| createdAt | Jan 14, 2026, 8:32 PM |
| updatedAt | Jan 14, 2026, 8:36 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8651 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8630 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 14, 2026, 8:36 PM |
Optimize HeaderCanvas Rendering (GC & Gradients)
tobiu added parent issue #8630 on Jan 14, 2026, 8:32 PM
tobiu assigned to @tobiu on Jan 14, 2026, 8:35 PM

tobiu
Jan 14, 2026, 8:35 PM
Input from Gemini 3 Pro:
✦ Refactored
HeaderCanvasfor maximum performance:
- Gradient Caching: Gradients (
grad1,bgRibbon, etc.) are now cached inthis.gradientsand only recreated on resize, instead of every frame.- Zero-Allocation Loop: Replaced per-frame
{x, y}object allocation withFloat32Arraybuffers (this.waveBuffers) for wave geometry. This eliminates thousands of objects per second from the GC cycle.- Refactored Logic: Updated
calculateStrandGeometryanddrawAmbientBackgroundto write directly to these buffers.This brings
HeaderCanvasup to the high-performance standard ofTicketCanvas.
tobiu closed this issue on Jan 14, 2026, 8:36 PM
Optimize
apps/portal/canvas/HeaderCanvas.mjsto reduce Garbage Collection (GC) pressure and improve rendering performance, inspired by the efficiency ofTicketCanvas.mjs.Identified Issues:
calculateStrandPointsanddrawAmbientBackgroundallocate new arrays and thousands of{x, y}object literals every frame (60fps). This causes significant GC overhead.createLinearGradientis called every frame with identical parameters (0 to width), creating unnecessary objects.Optimization Plan:
updateSize(or lazy-init with cache). Recreate only when dimensions change.Float32Arraybuffers to store wave geometry.this.waveBuffer(e.g., holding Y values).Target: Zero per-frame allocation for the core render loop.