canvas rect vs circle (v2)

Revision 2 of this benchmark created on


Description

Comparison of drawing point as a circle and as a rectangle

Preparation HTML

<canvas id="canvas" width="1280" height="720"></canvas>

Setup

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

Teardown


    if(Math.random() > 0.97) c.clearRect(0, 0, 1280, 720);
  

Test runner

Ready to run.

Testing in
TestOps/sec
point as rectangle
var x = Math.floor((Math.random()*1280)+1);
var y = Math.floor((Math.random()*720)+1);
c.fillRect(x,y,5,5);
ready
point as a circle
var x = Math.floor((Math.random()*1280)+1);
var y = Math.floor((Math.random()*720)+1);
c.beginPath();
c.arc(x, y, 5, 0, 2 * Math.PI, true);
c.fill();
ready

Revisions

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