Rect vs fillRect

Benchmark created on


Preparation HTML

<canvas id="canvas" width="1000" height="10"></canvas>
<script>
 var context = document.getElementById("canvas").getContext("2d");
 context.fillStyle = "#000000";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
fillRect()
for(var i=0;i<100;i++) {
 context.fillRect(i * 10, 0, 10, 10);
}
ready
rect() with fill()
context.beginPath();
for(var i=0;i<100;i++) {
 context.rect(i * 10, 0, 10, 10);
}
context.fill();
ready

Revisions

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