Canvas Drawing In Out

Benchmark created by Jack Rugile on


Preparation HTML

<canvas id="c" width="400" height="400"></canvas>

Setup

var c = document.getElementById('c');
    var ctx = c.getContext('2d');

Test runner

Ready to run.

Testing in
TestOps/sec
Draw In
ctx.fillRect(0,0,1,1);
ready
Draw Out
ctx.fillRect(-10,-10,1,1);
ready
Check If In Canvas
var x = -10;
var y = -10;
if(x >= 0 || y >= 0){
ctx.fillRect(x,y,1,1);
}
ready

Revisions

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

  • Revision 1: published by Jack Rugile on