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 width="800" height="600" id="canvas"></canvas>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var w = canvas.width,
h = canvas.height,
i, c = 100;
var circles = [],
circle;
for (i = 0; i < c; i++) {
circle = {};
circle.r = 50;
circle.x = Math.random() * (w - 2 * circle.r) + circle.r;
circle.y = Math.random() * (h - 2 * circle.r) + circle.r;
circle.color = 'blue';
circles.push(circle);
}
function drawCircle(circle) {
context.save();
context.beginPath();
context.arc(circle.x, circle.y, circle.r, 0, 4 * Math.PI);
context.fillStyle = circle.color;
context.fill();
context.restore();
}
// Setup Canvas by initially drawing scene
for (i = 0; i < c; i++) {
drawCircle(circles[i]);
}
var bufferCanvas = document.createElement('canvas'),
bufferContext = bufferCanvas.getContext('2d'),
pixelBuffer, imageBuffer = new Image(w, h);
bufferCanvas.width = w;
bufferCanvas.height = h;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Store Pixelbuffer |
| ready |
Store Imagebuffer |
| ready |
Store Canvasbuffer |
| ready |
Apply Pixelbuffer |
| ready |
Apply Imagebuffer |
| ready |
Apply Canvasbuffer |
| ready |
Simple Redraw |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.