canvas rect vs circle (v5)

Revision 5 of this benchmark created on


Description

Comparison of drawing point as a circle and as a rectangle

Preparation HTML

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

Setup

var c = document.getElementById('canvas').getContext("2d");
    c.clearRect(0, 0, 400, 400);

Test runner

Ready to run.

Testing in
TestOps/sec
point as rectangle
var x = Math.floor((Math.random()*400)+1);
var y = Math.floor((Math.random()*400)+1);
c.strokeRect(x,y,1,1);
ready
point as a circle
var x = Math.floor((Math.random()*400)+1);
var y = Math.floor((Math.random()*400)+1);
c.beginPath();
c.arc(x, y, 1, 0, 2 * Math.PI, true);
c.fill();
ready
point as filled rectangle
var x = Math.floor((Math.random()*400)+1);
var y = Math.floor((Math.random()*400)+1);
c.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.