Test name | Executions per second |
---|---|
di full | 87122.4 Ops/sec |
di half | 88671.7 Ops/sec |
pid full | 106398.6 Ops/sec |
pid half | 92882.2 Ops/sec |
<canvas id='master' width='100' height='100'></canvas>
<canvas id='clone' width='100' height='100'></canvas>
var master = document.getElementById('master');
var masterctx = master.getContext('2d');
var clone = document.getElementById('master').getContext('2d');
masterctx.fillRect(0,0,50,50);
masterctx.fillStyle = "red";
masterctx.fillRect(50,50,100,100);
var img = masterctx.getImageData(0,0,100,100);
var half = masterctx.getImageData(25,0,50,100);
clone.drawImage(master,0,0);
clone.clearRect(0,0,100,100);
clone.drawImage(master,25,0,50,100,25,0,50,100);
clone.clearRect(0,0,100,100);
clone.putImageData(img,0,0);
clone.clearRect(0,0,100,100);
clone.putImageData(half,25,0);
clone.clearRect(0,0,100,100);