TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

124 点作者 phsilva3 个月前

7 条评论

riffraff3 个月前
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 个月前
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 个月前
`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 个月前
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 个月前
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 个月前
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 个月前
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 未加载