htmlcanvasglobalcompositeoperation2d-context-api

Performance difference between 'source-over' and 'destination-over' globalCompositeOperation for HTML canvas


Having reviewed the various globalCompositeOperation options for drawing on a 2D canvas, it occurs to me that destination-over is essentially the same as the default source-over but with the elements drawn in reverse.

I was wondering if anyone knows whether there's a performance difference between these two operations when the canvas calculates the composition and draws the pixels.


Solution

  • In case anyone is interested I did set up a jsPerf to test this. According to my tests source-over is actually faster!

    jsPerf test can be found here: http://jsperf.com/canvas-source-over-vs-destination-over/2