requestanimationframe vs setInterval
JavaScript performance comparison
Test case created
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Testing in unknown unknown
| Test |
Ops/sec |
requestAnimationFrame |
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = (function() {
return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {
window.setTimeout(callback, 1000 / 60);
};
})();
}
function animate() { var i = 0; while (i < 1000000) { i++; } } requestAnimationFrame(function x() { animate(); window.requestAnimationFrame(x); });
|
pending… |
setInterval Loop |
function animate() { var i = 0; while (i < 1000000) { i++; } } var interval = setInterval(function() { animate(); }, 1000 / 60);
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
Compare results of other browsers
0 comments