In theory, one canvas would actually be faster, assuming that you should program an algorithm that only redraws what you had to redraw, and the redrawing method occurred immediately *. The redraw method may be one of the most demanding actions that the browser can take; all the better.
However, the amount of code needed to run such a system is probably not worth the effort in the end. I would just stick with a few canvases for convenience and extensibility.
Here are some other optimization tricks I learned:
Cleaning the entire canvas does not take longer than cleaning a specific area, and in fact it can be faster than sorting through all the objects and cleaning them individually.
setTimeout best suited for animations where it is important to see each frame. requestAnimationFrame can skip frames on less capable machines.
Checking to see if an element is in a range before trying to draw it can save processor cycles, even though the canvas API is all the same.
* To cause a one-time change, you can set the display canvas to none , and then return to block after changing the context.
source share