Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are tail calls slower than non-tail-calls? #7

Open
littledan opened this issue Apr 14, 2016 · 2 comments
Open

Are tail calls slower than non-tail-calls? #7

littledan opened this issue Apr 14, 2016 · 2 comments

Comments

@littledan
Copy link
Member

We have heard different things from different browsers:

  • JSC has reported that their PTC implementation makes existing code run faster.
  • Microsoft has a bug explaining why their current calling convention makes tail calls slower than ordinary calls Implement Proper Tail Call [Discussion] chakra-core/ChakraCore#796
  • V8 has not found a regression on large benchmarks with our PTC implementation, but it might be possible to find a microbenchmark with a regression when flipping the tail call flag on, even with extensive compiler work that we have done to support PTCs in various optimizing modes. We do not see PTCs as a way to improve performance of existing code.
  • SpiderMonkey @shu @efaust ?

I know this is being discussed on various different threads, but I hope we can compile results here.

@msaboff
Copy link

msaboff commented May 6, 2016

I think I may have been misquoted. For JSC, we don't find any performance changes good or bad with our PTC implementation. Certainly there are micro benchmarks that one can construct that would show performance deltas either way.

Given the instrumenting we did in JSC to gather PTC usage in the wild, it is easy to understand why we don't see any performance deltas. Our statistics show that PTC only happen ~5% of the time.

Assuming that the ChakraCore team doesn't regress standard call performance with their PTC implementation, the impact of any slowness of making a PTC will only impact overall performance by 1/20 the PTC slowdown given the incidence of actual PTCs we found.

@rossberg
Copy link
Member

FWIW, V8 also has found slight performance regressions with TCE activated. They are most visible (5+%) on artificial micro benchmarks, though. For "real-world" code, the regression was usually barely above noise level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants