render-vs-prerender

JavaScript performance comparison

Revision 68 of this test case created

Preparation code

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

                       
                        ctx.beginPath();
                        ctx.moveTo(0, 0);
                        for (var i = 0; i < 500; i++) {
                          var p1 = i*5;
                          var p2 = Math.sin(i/10)*100 + 100;
                          ctx.lineTo(p1, p2);
                        }
                        ctx.lineCap = "round";
                        ctx.lineJoin = "round";
                        ctx.lineWidth = 4;
                        ctx.strokeSytle = "rgb(0, 200, 0)";
                        ctx.stroke();

Preparation code output

var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.moveTo(0, 0); for (var i = 0; i < 500; i++) { var p1 = i*5; var p2 = Math.sin(i/10)*100 + 100; ctx.lineTo(p1, p2); } ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.lineWidth = 4; ctx.strokeSytle = "rgb(0, 200, 0)"; ctx.stroke();

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
render
ctx.beginPath();
ctx.strokeStyle = 'red';
ctx.lineWidth = 4;
ctx.moveTo(10, 10);
ctx.lineTo(10, 30);
ctx.lineTo(30, 30);
ctx.lineTo(40, 70);
ctx.quadraticCurveTo(72, 43, 22, 12);
ctx.quadraticCurveTo(12, 43, 12, 102);
ctx.stroke();
pending…
pre-rendered
ctx.drawImage(can2, 0, 0);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment