putImageData
is probably faster than fillRect
natively. I think this because the fifth parameter can have different ways to be assigned (the rectangle color), using a string that must be interpreted.
Suppose you're doing that:
context.fillRect(x, y, 1, 1, "#fff")
context.fillRect(x, y, 1, 1, "rgba(255, 255, 255, 0.5)")`
context.fillRect(x, y, 1, 1, "rgb(255,255,255)")`
context.fillRect(x, y, 1, 1, "blue")`
So, the line
context.fillRect(x, y, 1, 1, "rgba(255, 255, 255, 0.5)")`
is the most heavy between all. The fifth argument in the fillRect
call is a bit longer string.