I have problem with one native HTML5 canvas function
getImageData() on Mac OS. I run test for this function in jsperf with a similar power processors and result is:
Ubuntu 14.04 - chrome/opera: 300k operations/sec
Window 7/8/8.1 - chrome/opera/ie/mozilla: around 250k operations/sec
Mac OS - safari/chrome/opera: around 1k operations/sec
getImageData for better performance need use x,y only as variable integer values, second two parameters for better performance recommend use as 1px
var ctxData=canvasContext.getImageData(x,y,1,1); rgba = ctxData.data; /* rgba = red channel, rgba = green channel, rgba = blue channel, rgba = alpha channel */
the main thing was offered:
– cache canvas.width and canvas.height to avoid DOM access, just create ONE imageData that you keep on modifying (relieves the g.c.).
Would look something such as get static full canvas image data and use it, but i cannot use all the time static canvas data, because i create like a paint application while drawing every moment changing canvas context. Maybe somebody can anything to offer?