I'm drawing a visualization of data on a 600x600 pixel HTML canvas. Each pixel requires about 10 additions/multiplications, so a little computation, but not a ton. Unfortunately, this takes about half a second to draw. Which means my sliders, which affect every single pixel usually, do not update the visualization smoothly.
Is it possible to improve performance by drawing in a more efficient manner? I'm currently calling the following for every pixel:
ctx.fillStyle = computedPixelColor
ctx.fillRect(x, y, 1, 1)
I read that creating an image and modifying the pixels, then inserting that image in the HTML is slower. Is that true? Are there hacks to this process?