3 ms·
I have a feeling that certain things (e.g., reduce) will suddenly become much more performant with tail call optimization coming in ES6.
by warfangle 12y ago
I have a feeling that certain things (e.g., reduce) will suddenly become much more performant with tail call optimization coming in ES6.
- _greim_ 12y agoWould tail call optimization help in this case? AFAIK JS's iteration methods aren't recursive.
- warfangle 12y agoTail 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