HTML5 Canvas Performance with Konva
Canvas performance depends on scene complexity, redraw frequency, pixel count, and hit detection. Optimize the measured limit, not the node count alone.
Use browser performance tools on a representative device. Record frame time, memory use, and interaction delay for the real scene.
High-value Konva changes
- Put static and changing content on separate layers.
- Set
listening(false)on nodes or layers that do not receive events. - Hide nodes that are outside the visible area when the scene is very large.
- Cache a complex, stable node after measurement shows a rendering benefit.
- Reduce shadows, filters, and large transparent areas when they dominate frame time.
- Draw only after a data change. Konva batches layer draws automatically.
Do not cache every node. Each cache uses memory and creates extra work when its content changes.
Separate the interactive layer
This example puts 2,000 noninteractive circles on one layer. The layer skips
the hit canvas because listening is false. A second layer contains one
draggable shape.
Layer separation has a cost because each layer creates scene and hit canvases. Use a small number of layers with clear update patterns.
Read all Konva performance tips for animation, caching, pixel ratio, and shape-specific guidance.