Tuesday 7 December 2010

html5 canvas speed notes

Setting fill and Stroke style can have a negative performance impact even if you dont use them and are setting them to what they used to be. (Firefox)

ctx.fillStyle
ctx.strokeStyle



Also I can't make dirty rectangles code run as fast as just doing a big clearRect for the whole canvas. This is for frantic - a space invaders style game where nearly every sprite will have moved since the last paint

ctx.clearRect(0,0,width,height);


Drawing text on canvas:
fillText about twice as fast as strokeText

No comments:

Post a Comment