IronScheme 是解释型还是编译型?它是否受益于 .NET Framework 优化?

发布于 2024-10-01 11:20:58 字数 341 浏览 3 评论 0原文

在《IronPython in Action》一书中,作者指出,与 CPython 不同,IronPython 从 JIT 和框架本身的某些优化中受益,而 CPython 无法利用这些优化。因此,IronPython 可能比 CPython 更快,尤其是对于多线程场景。

IronScheme 是否能从此类优化中受益?它是一个解释器(而不是编译器)吗?它是一个解释器吗?因为这是 Lisp 的本质,必须对其进行解释才能提供类似 Lisp 的灵活性?如果它是解释器,它仍然可以从抖动优化中受益吗?

In the book "IronPython in Action," the author states that IronPython, unlike CPython, benefits from certain optimizations, both in the JIT and in the framework itself, that CPython cannot take advantage of. Consequently, IronPython is potentially faster than CPython is, especially for multithreading scenarios.

Does IronScheme benefit from such optimizations? Is it an interpreter (not a compiler), and is it an interpreter because that's the nature of Lisp, that it must be interpreted to provide the Lisp-like flexibility? If it is an interpreter, can it still benefit from optimizations in the jitter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对你再特殊 2024-10-08 11:20:58

与 IronPython(以及我基于 IronScheme 的 DLR 的第一个 Python)一样,IronScheme 一直编译到 IL 级别。

此外,IronScheme 中没有解释部分(除非您调用运行时符号查找),因为我几乎从 DLR 的“分支”中删除了所有这些部分,因为没有使用并减少了代码占用空间(我据估计,我只使用了大约 25% 的 DLR,其余部分则以 Python 为中心)。

要查看生成的 IL 内容,您可以查看 Reflector .NET 中的 ironscheme.boot.dll 程序集(最好使用 IL 模式,因为 C# 往往会进行奇怪的重组,并且在某些情况下完全是错误的)。整个程序集由 IronScheme 编译。查看运行时生成的代码要困难得多。

如前所述,这确实具有 JIT 的所有优点,并且随着我对 DLR 进行的优化更加以方案为中心,当我上次测试它时,它通常比 IronPython 执行得更快(至少是 18 个月前,我意识到)从那时起,IronPython 已经有了相当多的改进,但 IronScheme 的速度要快一些,甚至使用“感觉”更像 Python 的 Scheme 来进行球赛)。

此外,我尝试尽可能多地利用 .NET 框架作为 IronScheme 的基础,并使互操作性变得更容易。 向量字节向量二进制端口哈希表等都是基于普通的.NET我们都知道并使用的类;仅举几例,分别是 object[]byte[]StreamHashtable

Like IronPython (well the initial one with the DLR that I based IronScheme on), IronScheme is compiled all the way down to IL level.

Furthermore, there are no interpreted parts in IronScheme (unless you call runtime symbol lookup that), as I have pretty much ripped out all of that from my 'branch' of the DLR, due to not being used and reducing the code footprint (I estimated I only used about 25% of the DLR, where the rest was rather Python-centric).

To see what IL gets generated, you can look at the ironscheme.boot.dll assembly in Reflector .NET (using IL mode preferably, as C# tends to be restructured weirdly and just plain wrong in a few cases). This entire assembly is compiled by IronScheme. To see runtime generated code is a lot more trickier.

As said, this does have all the benefits of JIT, and with the optimizations I made on the DLR to be more Scheme-centric, it generally performed faster than IronPython when I last tested it (a good 18 months back at least, I realize IronPython has had quite a few improvements since then, but IronScheme was a few factors faster, even using Scheme that 'felt' more like Python to even the ball game).

Furthermore, I have attempted to utilize as much of the .NET framework as a foundation for IronScheme, and to make interoperability easier. Things like vectors, byte-vectors, binary-ports and hash-tables are based on the normal .NET classes we all know and use; object[], byte[], Stream and Hashtable respectively, to name a few.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文