Oh god, I could write you a complete sonnet here if you put all your code. Here is a summary:
Read Emir’s answer. All this is good, with the exception of the latter, which is very dependent on the situation. Setting canvas.width = canvas.width to clear the canvas may be faster in some browsers, but also clobbers the entire state of the canvas (i.e. the last set to fill and the font), which can slow down, because setting these properties actually hurts slow.
Read my Canvas Performance articles: http://simonsarris.com/blog/tag/performance
I have many other tips accumulated in a private document, of which I write a small e-book. If you want early access to it, I will probably allow this.
Lift Zakas High Performance JavaScript and read it.
Do not use save () and restore (), as in the cited code, unless you should . They just slow down.
For a timer see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
Several foreground-background-middleground canvases can definitely help. Caching things on pages in memory can definitely help. It all depends on what you draw.
Many performance issues are associated with the death of thousands of tiny cuts. For instance:
vs.scenegraph[i].update(); vs.scenegraph[i].draw(); vs.scenegraph[i].drawScript();
For
var scene = vs.scenegraph[i]; scene.update(); scene.draw(); scene.drawScript();
The minute amount will help. How many opportunities for the little things that you have, I do not know - we will need to see a lot more code.