3 ms·
Tail call optimization isn't just for recursive tail call optimization (though that is the most common scenario!). It simply refers to 'unrolling' that functio
by warfangle 12y ago
Tail call optimization isn't just for recursive tail call optimization (though that is the most common scenario!).
It simply refers to 'unrolling' that function call, so a new function doesn't need to be added to the stack.
JS's iteration methods aren't currently recursive, at least in V8[0]. But that's probably due to lack of TCO!
0. https://github.com/v8/v8/blob/master/src/array.js#L1378 https://github.com/v8/v8/blob/master/src/array.js#L1378