canvg vs canvas (v3)

Revision 3 of this benchmark created by Matheus on


Description

Testing for string parsing overhead.

Preparation HTML

<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js">
</script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js">
</script>
<canvas id="test" />

Setup

var canvas = document.getElementById("test");
    canvas.width = 500;
    canvas.height = 500;
    var c = canvas.getContext("2d");
    c.clearRect(0, 0, 500, 500);

Test runner

Ready to run.

Testing in
TestOps/sec
canvg
canvg(canvas, '<svg><path d="M 100 100 L 300 100 L 200 300 z" fill="green" stroke="blue" stroke-width="3" /></svg>', {
  ignoreMouse: true,
  ignoreAnimation: true,
  ignoreDimensions: true
});
ready
canvas
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.strokeStyle = "blue";
ctx.lineWidth = 3;
ctx.beginPath();
ctx.moveTo(200, 100);
ctx.lineTo(300, 100);
ctx.lineTo(200, 300);
ctx.closePath();
ctx.fill();
ctx.stroke();
ready

Revisions

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