As the title, why the requestAnimationFrame
recursion won't eat up RAM. This post said that the V8 engine has no optimization for the tail call
, so I think I must have missed something. Is that because the browser did something behind it? Or the V8 supports the optimization of tail call
?
Here's the MDN's example:
function step(timestamp) {
var progress = timestamp - start;
d.style.left = Math.min(progress/10, 200) + "px";
if (progress < 2000) {
requestAnimationFrame(step);
}
}
requestAnimationFrame(step);