jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<canvas id="screen" width="1024" height="768">
</canvas>
<script>
var context = document.getElementById("screen").getContext("2d");
var cellBackgroundLeft = document.createElement("img");
cellBackgroundLeft.src = "http://img201.imageshack.us/img201/2698/cellbackgroundleft.png";
var cellBackgroundRight = document.createElement("img");
cellBackgroundRight.src = "http://img194.imageshack.us/img194/156/cellbackgroundright.png";
var cellBackgroundMiddle = document.createElement("img");
cellBackgroundMiddle.src = "http://img824.imageshack.us/img824/2954/cellbackgroundmiddle.png";
function drawCellMiddleRect(x, y, width) {
context.fillStyle = "#4b4f57";
context.drawImage(cellBackgroundLeft, x, y);
context.fillRect(x + 4, y, width - 2 * 4, 63);
context.drawImage(cellBackgroundRight, x + width - 4, y);
}
function drawCellMiddleImage(x, y, width) {
context.fillStyle = "#4b4f57";
context.drawImage(cellBackgroundLeft, x, y);
context.drawImage(cellBackgroundMiddle, x + 4, y, width - 2 * 4, 63);
context.drawImage(cellBackgroundRight, x + width - 4, y);
}
function roundRect(ctx, x, y, width, height, radius, fill, stroke) {
if (!stroke) {
stroke = true;
}
if (!radius) {
radius = 5;
}
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
if (fill) {
ctx.fill();
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
drawCellMiddleRect |
| ready |
drawCellMiddleImage |
| ready |
roundRect |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.