Canvas 2d Render Perf

Performance techniques for canvas 2D render loops that draw thousands of small elements (star fields, particle systems, point clouds, scatter plots) and are CPU-bound or janky, especially on low-end devices. Use when a requestAnimationFrame canvas loop is slow, when optimizing a per-frame draw over many points, or when deciding what is actually expensive (per-element trig/projection vs canvas draw calls). Covers caching a slowly-changing projection and reprojecting at a low rate, sprite blitting (drawImage) instead of per-element beginPath/arc/fill and the per-element fillStyle color-string parse it avoids, color-bucket sprite atlases, sine/periodic lookup tables with bitwise-mask indexing, and decomposing cost before optimizing.

BlakeHastings 9621ae4 6.7 KB Updated

File contents

BlakeHastings/claude-code-artifacts/tree/main/canvas-2d-render-perf commit 9621ae4cb7

Frequently asked questions

npx skillmds@latest add blakehastings/canvas-2d-render-perf