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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Mapping Python to LLVM

121 点作者 arshajii超过 2 年前

14 条评论

fernly超过 2 年前
A major type-incompatibility not mentioned in the linked blog post is this, from[1],<p>* Strings: Codon currently uses ASCII strings unlike Python&#x27;s unicode strings.<p>Judas priest, after all the effin&#x27; grief we went through to learn how to handle Unicode strings in Python 3, and to finally begin to realize their value, you take this step backward? Forget the i64 limits, the lack of native Unicode strings is a flat deal-breaker. (For example, will Codon warn if it sees an &quot;open(encoding=&#x27;UTF8&#x27;)&quot; call? Or a normal open(mode=&#x27;rt&#x27;) if the default local encoding is UTF8?)<p>It doesn&#x27;t help that the same doc also mentions that<p>* Dictionaries: Codon&#x27;s dictionary type is not sorted internally, unlike Python&#x27;s<p>Current Python dicts are not &quot;sorted&quot;; rather they &quot;preserve insertion order, meaning that keys will be produced in the same order they were added sequentially over the dictionary.&quot;[2]<p>This is new functionality added only recently (3.7) so its lack would not inconvenience a lot of existing code. OTOH, why did they not plan to reproduce this useful feature from the start?<p>Possibly they were thinking of the pypi package SortedContainers[3]?<p>[1] <a href="https:&#x2F;&#x2F;docs.exaloop.io&#x2F;codon&#x2F;general&#x2F;differences" rel="nofollow">https:&#x2F;&#x2F;docs.exaloop.io&#x2F;codon&#x2F;general&#x2F;differences</a><p>[2] <a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;reference&#x2F;datamodel.html#index-30" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;reference&#x2F;datamodel.html#index-30</a><p>[3] <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;sortedcontainers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;sortedcontainers&#x2F;</a>
评论 #34318698 未加载
debatem1超过 2 年前
The type conversion assumptions here are real problematic. &quot;64 bits ought to be enough for anybody&quot;-style statements ignore integers as bitfields, large constants (eg Avogadro&#x27;s number), any kind of math with large intermediate terms, all kinds of stuff.<p>Makes me very suspect about the rest of this project when they try to glide past all of these issues with nary a mention.
评论 #34316926 未加载
评论 #34318148 未加载
评论 #34316833 未加载
maximilianburke超过 2 年前
I recall that Google had a project to compile Python to LLVM (Unladen Swallow @ <a href="https:&#x2F;&#x2F;code.google.com&#x2F;archive&#x2F;p&#x2F;unladen-swallow&#x2F;" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;archive&#x2F;p&#x2F;unladen-swallow&#x2F;</a>), but work stopped on it a long time ago.<p>If I recall it really wasn&#x27;t that much faster than CPython given the overhead, but it&#x27;s been a long time; if it was faster I assume it wouldn&#x27;t have been abandoned.
评论 #34318846 未加载
评论 #34322806 未加载
toxik超过 2 年前
Codon is very impressive, it feels a lot like Python without being slow like Python.<p>Don’t think of it as a Python compiler, it is its own language. (Esp. re choice of int == i64, this saves SO MUCH computation for the CPU.)<p>I will say though that I’m not sure where to use it yet, since it’s too immature for important projects and also aims at the “we need a nuclear bomb” level performance.
eyegor超过 2 年前
&gt; How can I use Codon for production or commercial use?<p>&gt; Please reach out to... to inquire about about a production-use license.<p>Having &quot;contact us&quot; pricing with several incompatibilities makes this pretty hard to consider in a commercial environment. I wish they had a public pricing structure.<p>From their faq: <a href="https:&#x2F;&#x2F;docs.exaloop.io&#x2F;codon&#x2F;general&#x2F;faq" rel="nofollow">https:&#x2F;&#x2F;docs.exaloop.io&#x2F;codon&#x2F;general&#x2F;faq</a>.
评论 #34320610 未加载
dragonwriter超过 2 年前
&gt; int can become an LLVM i64<p>You can be efficient without sacrificing correctness; using LLVM shouldn’t mean “throw out arbitrary-precision semantics”.
评论 #34315063 未加载
TazeTSchnitzel超过 2 年前
How much does this differ from PyPy&#x27;s RPython in terms of how the language is restricted?
评论 #34321436 未加载
julienfr112超过 2 年前
kind of like numba, isn&#x27;t it ?
评论 #34318099 未加载
maxloh超过 2 年前
How good is Coden&#x27;s performance compared to Cyphon and mypyc?
mypalmike超过 2 年前
Very well written article. Delves into some details of things like exception handling semantics without going too far in the weeds. Thanks for sharing.
lowbloodsugar超过 2 年前
Have to assign variables to a bit of memory on the stack because SSA??
评论 #34319436 未加载
edelsohn超过 2 年前
How does Codon leverage the lessons learned from Unladen Swallow?
评论 #34316376 未加载
amir734jj超过 2 年前
The LinkedIn href is wrong in exaloop.io website
sakesun超过 2 年前
A very clean and beautiful blog design.