prerendering
JavaScript performance comparison
Preparation code
<canvas id="keyboard" height="110" width="800" style="border: solid;">
</canvas>
<script>
Benchmark.prototype.setup = function() {
var ctx = keyboard.getContext("2d");
ctx.textAlign = "center";
ctx.font = "50px times";
function nonOperator(x, y) {
var numbers = "7894561230.";
var where = 0;
var ctx = keyboard.getContext("2d");
for (var j = 0; j < 3; j++) {
for (var i = 0; i < 3; i++) {
ctx.beginPath();
ctx.rect(i * 70 + 6 * i, j * 55 + 6 * j, 70, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], i * 70 + 6 * i + 35, j * 55 + 6 * j + 43);
where++;
}
}
ctx.beginPath();
ctx.rect(0, 61 * 3, 146, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], 73, 61 * 3 + 43);
where++;
ctx.beginPath();
ctx.rect(146 + 6, 61 * 3, 70, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], 146 + 6 + 35, 61 * 3 + 43);
where++;
}
var kk=document.createElement("canvas");
kk.height=1300;
kk.width=1300;
var numbers = "7894561230.";
var where = 0;
var ctx = kk.getContext("2d");
ctx.textAlign = "center";
ctx.font = "50px times";
for (var j = 0; j < 3; j++) {
for (var i = 0; i < 3; i++) {
ctx.beginPath();
ctx.rect(i * 70 + 6 * i, j * 55 + 6 * j, 70, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], i * 70 + 6 * i + 35, j * 55 + 6 * j + 43);
where++;
}
}
ctx.beginPath();
ctx.rect(0, 61 * 3, 146, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], 73, 61 * 3 + 43);
where++;
ctx.beginPath();
ctx.rect(146 + 6, 61 * 3, 70, 55);
ctx.fillStyle = "green";
ctx.fill();
ctx.fillStyle = "white";
ctx.fillText(numbers[where], 146 + 6 + 35, 61 * 3 + 43);
where++;
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
no prerender |
|
pending… |
prerender |
|
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
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
0 comments