render-vs-prerender
JavaScript performance comparison
Preparation code
<canvas id="canvas1" width="500" height="500">
</canvas>
<script>
var can = document.getElementById('canvas1');
var ctx = can.getContext('2d');
var arrComplexPath = [0,116.7,0.900009,113.3,2.3,110.1,3.60001,107,5.40001,104,7.3,102.1,9.7,99.6,10.8,98.9,12,98.3,14.1,96.7,16.3,94.9,18.1,93.2,20,91.7,21.6,90.3,22.4,89,23.5,86.1,24.3,82.8,24.5,80.1,24.7,76.7,25.2,73.8,26.2,69.7,27.5,66.8,28.5,64.7,30.5,62.2,32.4,60.3,33.5,59.6,35.4,58.6,37.1,57.3,39,55.8,41.2,54.2,42.5,53.1,43.6,51.9,44.7,50,45.9,46.5,47.5,41,47.9,37.6,48.1,34.2,48.3,33.5,48.9,32.3,49.6,31.2,50.1,30,51,28.9,52.7,27.2,54.9,25.3,58.6,22.3,60.3,20.8,61.8,19.6,63.9,18.4,65.6,17,67.1,15.9,68.1,14.6,69.2,12.7,69.4,12,69.8,9.70001,70,6.29999,71.3,0];
var can2 = document.createElement('canvas');
can2.width = 150;
can2.height = 150;
var ctx2 = can2.getContext('2d');
var prevX = arrComplexPath[0];
var prevY = arrComplexPath[1];
var midX = prevX,
midY = prevY;
ctx2.beginPath();
for (var i = 2; i < arrComplexPath.length; i += 2) {
var xTo = arrComplexPath[i],
yTo = arrComplexPath[i + 1];
ctx2.moveTo(midX, midY);
midX = (prevX + xTo) / 2;
midY = (prevY + yTo) / 2;
ctx2.quadraticCurveTo(prevX, prevY, midX, midY);
prevX = xTo;
prevY = yTo;
}
//line from last mid point to end of path.
ctx2.moveTo(midX, midY);
ctx2.lineTo(xTo, yTo);
ctx2.stroke();
ctx2.fill();
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
render |
|
pending… |
pre-rendered |
|
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:
- Revision 1: published by Simon
- Revision 2: published
- Revision 3: published by Boris
- Revision 4: published
- Revision 5: published
- Revision 7: published
- Revision 8: published
- Revision 9: published
- Revision 10: published by Canvas integer coordinates vs. coordinates + .5
- Revision 11: published by Canvas integer coordinates vs. coordinates + .5
- Revision 12: published by Canvas integer coordinates vs. coordinates + .5
- Revision 13: published by Canvas integer coordinates vs. coordinates + .5
- Revision 14: published by Canvas integer coordinates vs. coordinates + .5
- Revision 15: published by Bhavesh Bagadiya
- Revision 16: published by Canvas integer coordinates vs. coordinates + .5
- Revision 17: published by Bhavesh Bagadiya
- Revision 18: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 26: published
- Revision 27: published
- Revision 28: published
- Revision 29: published
- Revision 30: published
- Revision 31: published
- Revision 32: published
- Revision 33: published
- Revision 44: published
- Revision 45: published
- Revision 47: published by Hairo
- Revision 48: published
- Revision 49: published
- Revision 50: published
- Revision 52: published by yura
- Revision 53: published by roemly
0 comments