Context2D self-drawImage

Benchmark created on


Setup

var canvas1 = document.createElement('canvas')
;
var canvas2 = document.createElement('canvas')
;
for (var canvas of [canvas1, canvas2]) {
	canvas.width = 256;
	canvas.height = 256;
}

var cx1 = canvas1.getContext('2d');
var cx2 = canvas2.getContext('2d');

for (var cx of [cx1, cx2]) {
	cx.globalCompositeOperation = 'copy';
}

Test runner

Ready to run.

Testing in
TestOps/sec
drawImage(self)
cx1.drawImage(canvas1, 1, 1);
ready
drawImage(other)
cx1.drawImage(canvas2, 1, 1);
ready
drawImage(self) by ping-pong
cx2.drawImage(canvas1, 0, 0);
cx1.drawImage(canvas2, 1, 1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.