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="canvas1"></canvas>
<canvas id="canvas2"></canvas>
<script>
(function() {
var lastTime = 0;
var vendors = ["ms", "moz", "webkit", "o"];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"];
window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] || window[vendors[x] + "CancelRequestAnimationFrame"];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());
var c_canvas = document.createElement("canvas");
var c_context = c_canvas.getContext("2d");
c_canvas.width = 100;
c_canvas.height = 100;
drawCircle();
function drawCircle() {
c_context.beginPath();
c_context.fillStyle = 'red';
c_context.lineWidth = 4;
c_context.arc(50,50,35,0,2 * Math.PI, true);
c_context.arc(150,50,35,0,2 * Math.PI, true);
c_context.arc(250,50,35,0,2 * Math.PI, true);
c_context.stroke();
c_context.fill();
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
drawImage |
| ready |
render per frame |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.