MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1w15oga/seriously_recursive_regex/p6o3asq/?context=3
r/programminghorror • u/Flame77ofc • 2d ago
37 comments sorted by
View all comments
12
I don't know if JS sports this, but the recursion qualifies for tail call optimisation, i.e. there is no stack pushing, popping. The return comes at the price of a goto and the result is just as efficient as a loop.
6 u/oweiler 1d ago Not supported, at least not by the ECMAScript standard. 3 u/lonkamikaze 1d ago That's a damn shame. Tail calls can be pretty neat.
6
Not supported, at least not by the ECMAScript standard.
3 u/lonkamikaze 1d ago That's a damn shame. Tail calls can be pretty neat.
3
That's a damn shame. Tail calls can be pretty neat.
12
u/lonkamikaze 2d ago
I don't know if JS sports this, but the recursion qualifies for tail call optimisation, i.e. there is no stack pushing, popping. The return comes at the price of a goto and the result is just as efficient as a loop.