TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A tail calling interpreter for Python (already landed in CPython)

124 pointsby phsilva3 months ago

7 comments

riffraff3 months ago
How does this differ from direct threading interpreters?<p>It seems like it solves the same problem (saving the function call overhead) and has the same downsides (requires non-standard compiler extensions)<p>EDIT: it seems the answer is that compilers do not play well with direct-threaded interpreters and they are able to perform more&#x2F;better optimizations when looking at normal-sized functions rather than massive blocks<p><a href="http:&#x2F;&#x2F;lua-users.org&#x2F;lists&#x2F;lua-l&#x2F;2011-02&#x2F;msg00742.html" rel="nofollow">http:&#x2F;&#x2F;lua-users.org&#x2F;lists&#x2F;lua-l&#x2F;2011-02&#x2F;msg00742.html</a>
评论 #43112497 未加载
评论 #43116851 未加载
评论 #43112649 未加载
saidinesh53 months ago
Recent discussion: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42999672">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42999672</a><p>Do check out the articles in the top most comment.. about how tail call optimization gets you faster interpreters.<p>It completely eliminates the overhead of function calls in the generated machine code while you still your code modularly using functions.
评论 #43111650 未加载
评论 #43112498 未加载
__s3 months ago
`return goto f()` syntax in C seems interesting<p>I had a similiar idea that Python could have `return from f()` to support tail calls without the issues raised about implicit tail calls
dammaj3 months ago
To read about the basics of tail calls optimization:<p><a href="https:&#x2F;&#x2F;blog.reverberate.org&#x2F;2021&#x2F;04&#x2F;21&#x2F;musttail-efficient-interpreters.html" rel="nofollow">https:&#x2F;&#x2F;blog.reverberate.org&#x2F;2021&#x2F;04&#x2F;21&#x2F;musttail-efficient-i...</a>
asicsp3 months ago
See also this little bit of discussion about a week back: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42999672">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42999672</a>
thunkingdeep3 months ago
This does NOT mean Python will get Tail Call Optimization, as Guido cannot be shown The Light, and has decided.
评论 #43111490 未加载
评论 #43110815 未加载
评论 #43110832 未加载
评论 #43112657 未加载
VWWHFSfQ3 months ago
Will Python ever get fast? Or even _reasonably_ fast?<p>The answer is no, it will not. Instead they&#x27;ll just keep adding more and more syntax. And more and more ways to do the same old things. And they&#x27;ll say that if you want &quot;fast&quot; then write a native module that we can import and use.<p>So then what&#x27;s the point? Is Python really just a glue language like all the rest?
评论 #43111277 未加载
评论 #43111179 未加载
评论 #43111282 未加载
评论 #43111343 未加载