浏览器中的 Python:如何在 Brython、PyPy.js、Skulpt 和 Transcrypt 之间进行选择?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30155551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python in Browser: How to choose between Brython, PyPy.js, Skulpt and Transcrypt?
提问by P i
I'm very excited to see that it is now possible to code Python in the browser. These are the main candidates (please add any I may have overlooked):
我很高兴看到现在可以在浏览器中编写 Python 代码了。这些是主要候选人(请添加我可能忽略的任何内容):
But how to choose between them? The only obvious difference I can see is that Skulpt is based on Python 2, whereas Brython is based on Python 3.
但是如何在它们之间进行选择呢?我能看到的唯一明显区别是 Skulpt 基于 Python 2,而 Brython 基于 Python 3。
Please note: This is not a request for recommendations or opinions. I'm seeking objective facts that would inform an educated choice.
请注意:这不是对建议或意见的请求。我正在寻找能够为受过教育的选择提供信息的客观事实。
采纳答案by laike9m
Running Python in the Browseris a really good and up-to-date(as of 2019) article that compares Brython, Skulpt, PyPy.js, Transcrypt, Pyodide, Batavia. I highly recommend reading it.
在浏览器中运行 Python是一篇非常好的最新(截至 2019 年)文章,比较了 Brython、Skulpt、PyPy.js、Transcrypt、Pyodide、Batavia。我强烈推荐阅读它。
A good summary can be seen in the following pictures.
一个很好的总结可以在下面的图片中看到。
回答by P i
This page benchmarks the three candidates. Brython emerges as a clear winner.
此页面对三个候选人进行了基准测试。Brython 显然是赢家。
Despite the 'help' explaining that S.O. is not good for this kind of question, it appears that a concise answer is in this case possible.
尽管“帮助”解释了 SO 不适用于此类问题,但在这种情况下似乎可以提供简洁的答案。
Maybe people are being too hasty?
也许人们太仓促了?
回答by Olemis Lang
First of all I'm a Brython committer . Nevertheless I'll try to be as impartial as possible for the sake of doing an objective assessment .
首先,我是 Brython 提交者。尽管如此,为了进行客观评估,我会尽量保持公正。
The last time I used it Skulpt did not support features like generator expressions . Brython and PyPy.js do so , so at the feature level IMHO the later are superior .
我上次使用它时 Skulpt 不支持诸如生成器表达式之类的功能。Brython 和 PyPy.js 这样做,所以在功能级别恕我直言,后者更胜一筹。
Brython (at this time) is still work in progress . Some modules cannot be imported (e.g. xml.ElementTree) . Nevertheless this situation is starting to change since we are working towards running the whole CPython test suite in spite of achieving full compatibility with standards (at least when it makes sense) .
Brython(此时)仍在进行中。某些模块无法导入(例如xml.ElementTree)。尽管如此,这种情况开始改变,因为我们正在努力运行整个 CPython 测试套件,尽管实现了与标准的完全兼容(至少在有意义的时候)。
Brython also supports .vfs.js to speed up module imports .
Brython 还支持 .vfs.js 以加快模块导入。
PyPy.js has a number of characteristics that follow straightforward from the fact of it being powered by PyPy (JIT compilation , well tested , ...) but I'm not sure of whether it is suitable for running in the browser . This might change as the project evolves .
PyPy.js 具有许多特性,从它由 PyPy 提供支持的事实(JIT 编译、经过良好测试,...)可以直接看出,但我不确定它是否适合在浏览器中运行。这可能会随着项目的发展而改变。
TODO: I'll try to complement my answer with reliable benchmarks .
TODO:我将尝试用可靠的基准来补充我的答案。
回答by albertjan
I've used and committed to skulpt as well as pypyjs. And they are all three very different that any comparison is moot if you ask me.
我已经使用并致力于 skulpt 以及 pypyjs。他们三个都非常不同,如果你问我,任何比较都是没有意义的。
It depends on what you are looking for which will make the most sense.
这取决于您正在寻找什么最有意义。
PyPyJS
pyjs
pypyjs is huge it's a 12MB javascript file that contains the entire pypy virtual machine. So if you want python implementation completeness this is your baby. It has a javascript bridge that works really good but it's not a viable option for writing your javascript website code in python. It will however let you import compiler
.
pypyjs 很大,它是一个 12MB 的 JavaScript 文件,包含整个 pypy 虚拟机。所以如果你想要 python 实现的完整性,这就是你的宝贝。它有一个 javascript 桥,效果很好,但它不是用 python 编写 javascript 网站代码的可行选择。然而,它会让你import compiler
。
It's built with emscripten and is fasterthen CPython, in running the pystone benchmark.
它是用 emscripten 构建的,在运行 pystone 基准测试时比CPython更快。
I gave a short talk about pypyjs hereare the slides.
我简短地介绍了 pypyjs,这里是幻灯片。
Skulpt
造型
Is a teaching tool (or it has evolved into that over time), it compiles your python into a state machine very closely emulating the cpython compiler. At it's core it's a handwritten implementation of the python compiler in javascript. It allows for asynchronous execution which lets you do:
是一个教学工具(或者它已经随着时间的推移演变成),它将你的 python 编译成一个状态机,非常接近地模拟 cpython 编译器。它的核心是在 javascript 中手写的 python 编译器实现。它允许异步执行,让您可以:
while (True):
print "hi"
Without locking up the browser.
无需锁定浏览器。
Skulpt is the only one that supports asynchronous continuations, it lets you pause the execution of python while it's resolving some asynchronous thing to happen. Making this work:
Skulpt 是唯一一个支持异步延续的工具,它可以让你在解决一些异步事件的同时暂停 Python 的执行。使这项工作:
from time import sleep
sleep(1)
Skulpt runs at about a tenth of the speed of CPython, when comparing pystone.
与 pystone 相比,Skulpt 的运行速度大约是 CPython 的十分之一。
Brython
布莱顿
I know least about this one maybe @olemis-lang can expand this one. But next to the obvious difference that Brython is py3 and the others py2. Brython is also a transpiler.
我对这个最不了解,也许@olemis-lang 可以扩展这个。但除了 Brython 是 py3 和其他 py2 的明显区别之外。Brython 也是一个转译器。
Brython doesn't run the pystone benchmark because time.clock isn't implemented, because officially it's a hardware function.
Brython 不运行 pystone 基准测试,因为 time.clock 没有实现,因为它正式是一个硬件功能。
回答by fzzylogic
Here's some info on Brython vs Transcrypt (July 2016, since Transcrypt was added as an option on this question by the OP), gleaned by starting off a project with Brython a few months ago and moving to Transcrypt (completed moving last week). I like Brython and Transcrypt and can see uses for both of them.
这里有一些关于 Brython 与 Transcrypt 的信息(2016 年 7 月,因为 Transcrypt 被 OP 添加为这个问题的一个选项),通过几个月前与 Brython 开始一个项目并转移到 Transcrypt(上周完成移动)收集。我喜欢 Brython 和 Transcrypt,并且可以看到它们的用途。
For people that are new to this, Brython and Transcrypt both 'transpile' python input to javascript (Edit: maybe it's better to view Brython as a 'a Python implementation for the browser' because it doesn't produce standalone javascript). Both require Python 3 syntax. Brython includes a substantial number of Python standard libraries and some of it's own for dealing with web related things, whereas Transcrypt avoids that for the most part and suggests using Javascript libraries instead.
对于新手来说,Brython 和 Transcrypt 都将 Python 输入“转换”到 javascript(编辑:也许最好将 Brython 视为“浏览器的 Python 实现”,因为它不会生成独立的 javascript)。两者都需要 Python 3 语法。Brython 包含大量 Python 标准库,其中一些是自己用于处理 Web 相关事物的,而 Transcrypt 在大多数情况下避免了这种情况,并建议使用 Javascript 库代替。
Brython(Github) can do the conversion in the browser. So you write in python and the brython.js engine converts it to javascript on the fly when the page is loaded. This is really convenient, and is much faster than you might think. However, the brython.js engine that you need to include in your pages is about 500Kb. Also, there's the matter of importing standard libraries, which Brython handles by fetching separate .js files with XHR requests. Some libs are already compiled into brython.js, so not every import will pull in new files, but if you use many imports, things can get slow. However, there are ways around this. What i did was to check the network tab in browser dev tools to see what files were being pulled in when the page was loaded, then delete all the files my project wasn't using in a copy of the Brython src folder, and run the script included with Brython (i think it's at Brython/www/scripts/make_VFS.py) that compiles all of the available libs into one file called py_VFS.js that you need to also link to from your html. Normally, it will make one huge 2MB+ file, but if you delete the things you aren't using, it can be quite tiny. Doing it this way, means you only need to pull in brython.js, py_VFS.js and your python code, and no additional XHR requests will be needed.
布莱顿( Github) 可以在浏览器中进行转换。所以你用 python 编写,当页面加载时,brython.js 引擎将它即时转换为 javascript。这真的很方便,而且比您想象的要快得多。但是,您需要在页面中包含的 brython.js 引擎大约为 500Kb。此外,还有导入标准库的问题,Brython 通过使用 XHR 请求获取单独的 .js 文件来处理该问题。一些库已经编译到 brython.js 中,所以不是每个导入都会拉入新文件,但是如果你使用很多导入,事情会变慢。但是,有一些方法可以解决这个问题。我所做的是检查浏览器开发工具中的网络选项卡以查看加载页面时正在拉入哪些文件,然后删除我的项目在 Brython src 文件夹的副本中未使用的所有文件,并运行 Brython 附带的脚本(我认为它位于 Brython/www/scripts/make_VFS.py),它将所有可用的库编译成一个名为 py_VFS.js 的文件,您还需要从 html 链接到该文件。通常,它会生成一个 2MB+ 的巨大文件,但是如果您删除不使用的内容,它可能会非常小。这样做,意味着你只需要引入 brython.js、py_VFS.js 和你的 python 代码,不需要额外的 XHR 请求。
Transcrypt(Github)on the other hand, is distributed as a python 3 packagethat you can use manually, or hook into your toolchain, to compile python to javascript in advance. So with Transcrypt, you write in python, run transcrypt against the python and it spits out javascript that you can link to in your project. It is more like a traditional compiler also in that it offers some control over the output. For example, you can choose to compile to ES6 or ES5, or ask it to output sourcemaps (that during debugging let's the browser take you directly to the corresponding python code, insead of the generated javascript code.) Transcrypt's javascript output is pretty terse (or put another way, it's pretty and terse). In my case 150kB of python is converted to 165kB of unminified ES5 javascript. By way of comparison, the Brython version of my project used about 800Kb after conversion.
另一方面,Transcrypt(Github)作为python 3 包分发您可以手动使用,或挂钩到您的工具链中,提前将 python 编译为 javascript。所以使用 Transcrypt,你用 python 编写,对 python 运行 transcrypt,它会吐出 javascript,你可以在你的项目中链接到它。它更像是一个传统的编译器,因为它提供了对输出的一些控制。例如,你可以选择编译到 ES6 或 ES5,或者让它输出 sourcemaps(在调试时让浏览器直接带你到相应的 python 代码,而不是生成的 javascript 代码。)Transcrypt 的 javascript 输出非常简洁(或者换句话说,它既漂亮又简洁)。在我的情况下,150kB 的 python 被转换为 165kB 的未缩小的 ES5 javascript。作为比较,我项目的 Brython 版本在转换后使用了大约 800Kb。
However, getting the benefits of Transcrypts terseness, requires reading the docs a bit (really just a bit). For example, with Transcrypt, Python's 'truthiness' for data structures like dict, set and list isn't enabled by default and globally enabling it is discouraged because of potential performance issues related to typechecking. For clarity: Under CPython, an empty dict, set or list has truth value False, whereas in Javascript it's considered 'true'.. Example:
然而,获得 Transcrypts 简洁的好处,需要阅读一些文档(真的只是一点)。例如,对于 Transcrypt,Python 对 dict、set 和 list 等数据结构的“真实性”默认情况下不启用,并且由于与类型检查相关的潜在性能问题,不鼓励全局启用它。为清楚起见:在 CPython 下,空的 dict、set 或 list 的真值为 False,而在 Javascript 中,它被认为是“真”.. 示例:
myList = []
if myList: # False in CPython bcs it's empty, true in javascript bcs it exists
# do some things.
There are at least three ways to address this:
至少有三种方法可以解决这个问题:
- Use the -t flag when converting python to javascript e.g.: $ transcrypt -t python.py (not recommended, but probably isn't a problem unless you check for truthiness many times in inner loops of performance sensitive code..)
- Use
__pragma__(tconv)
or__pragma__(notconv)
within your code to tell the transcrypt compiler to switch on automatic conversion to python-like truth values locally. - Instead of checking for the truth value, avoid the problem altogether by just checking len(myList) > 0... Maybe that will be fine for most situations, does the job for my light use.
- 在将 python 转换为 javascript 时使用 -t 标志,例如:$ transcrypt -t python.py(不推荐,但可能不是问题,除非您在性能敏感代码的内部循环中多次检查真实性..)
- 使用
__pragma__(tconv)
或__pragma__(notconv)
在您的代码中告诉 transcrypt 编译器在本地打开自动转换为类似 python 的真值。 - 与其检查真值,不如通过检查 len(myList) > 0 来完全避免这个问题……也许这在大多数情况下都没有问题,适合我的轻度使用。
Right, so my project was getting bigger and i wanted to pre-compile for a performance gain but found it hard to do so with Brython (though it's technically possible, an easy way being to use the online editorand click the javascript button to see the output). I did that and linked to the generated javascript from project.html but it didn't work for some reason. Also, I find it hard to understand error messages from Brython so i didn't know where to start after this step failed. Also, the big size of the outputted code and the size of the brython engine was beginning to bug me. So i decided to have a closer look at Transcrypt, which had at first seemed to be higher grade because i prefer dumbed down instructions that tell me how to get started immediately (these have since been added).
是的,所以我的项目越来越大,我想预编译以提高性能,但发现 Brython 很难做到这一点(尽管在技术上是可行的,一种简单的方法是使用在线编辑器并单击 javascript 按钮查看输出)。我这样做并链接到从 project.html 生成的 javascript 但由于某种原因它不起作用。另外,我发现很难理解来自 Brython 的错误消息,所以在这一步失败后我不知道从哪里开始。此外,输出代码的大尺寸和 brython 引擎的尺寸开始困扰我。所以我决定仔细研究 Transcrypt,它起初似乎更高,因为我更喜欢告诉我如何立即开始的简化说明(这些已经添加了)。
The main thing getting it set up after installing Python3.5 was:
安装 Python3.5 后设置它的主要内容是:
- Use venv (it's like a new built-in version of virtualenv that uses less space for each project) to set up a python3.5 project folder (just type: python3.5 -m venv foldername - workaround for ubuntu with package issues for 3.5). This makes 'foldername' with a bin subfolder among other things.
- Install Transcrypt python package with pip ('foldername/bin/pip install transcrypt') which installs it to foldername/lib/python3.5/site-packages/transcrypt.
activate
the current terminal if you don't want to have to type the full path to foldername/bin/python3.5 every time. Activate by typing: 'source foldername/bin/activate'- Begin writing code and compiling it to javascript for testing. Compile from within the folder you write your code in. For example, i used foldername/www/project. So CD into that folder and run: 'transcrypt -b your_python_script.py'. That puts the output in a subfolder called
__javascript__
. You can then link to the outputted javascript from your html.
- 使用 venv(它就像一个新的内置版本的 virtualenv,它为每个项目使用更少的空间)来设置一个 python3.5 项目文件夹(只需键入:python3.5 -m venv foldername - ubuntu 的解决方法,包问题 3.5)。这使得 'foldername' 带有一个 bin 子文件夹等。
- 使用 pip ('foldername/bin/pip install transcrypt') 安装 Transcrypt python 包,将其安装到文件夹名/lib/python3.5/site-packages/transcrypt。
activate
如果您不想每次都输入文件夹名/bin/python3.5 的完整路径,请使用当前终端。通过键入激活:“源文件夹名称/bin/activate”- 开始编写代码并将其编译为 javascript 以进行测试。从您编写代码的文件夹内编译。例如,我使用了文件夹名/www/project。所以CD进入该文件夹并运行:'transcrypt -b your_python_script.py'。这会将输出放在名为
__javascript__
. 然后,您可以从您的 html 链接到输出的 javascript。
Main issues moving across
跨越的主要问题
I have rather simple needs, so your mileage may vary.
我有相当简单的需求,所以你的里程可能会有所不同。
You need to replace brython or python standard libs with javascript libs. So for example 'import json' is provided by Brython, but under Transcrypt you could use a javascript lib or just use JSON.parse / JSON.stringify directly in your Python code. To include a minified version of a javascript library directly in your python code use this format (note the triple quotes):
__pragma__ ('js', '{}', ''' // javascript code ''')
Brython's html specific functions don't work with Transcrypt obviously. Just use the normal javascript ways. Examples: 1) under Brython, you might have referred to a specific HTML tag using 'document['id']', but with Transcrypt you'd use 'document.getElementById('id') (which is the same way you do it from javascript). 2) You can't delete a node with 'del nodeName' (bcs that's a brython function). Use something like 'node.parentNode.removeChild(node)'. 3) replace all of brython's DOM functions with the javascript alternatives. e.g. class_name = className; text = textContent; html = innerHTML; parent = parentNode; children = childNodes etc. I guess if you need something that contains alternatives required by some older browsers then there are javascript libraries for that. 4) Brython's set_timeout is replaced with javascripts setTimeout 5) Brython's html tags such as BR() need to be replaced using the normal javascript ways as well as redoing any places you used it's <= dom manipulation syntax. Either inject plain text markup as innerHTML or make the elements using javascript syntax and then attach them using normal javascript DOM syntax. I also noticed that for checkboxes brython uses "if checkbox = 'checked':" but Transcrypt is happy with "if checkbox:"..
I finished moving a 2700 line project over last week at which time Transcrypt didn't have support for a few minor things (though they were easy enough to replace with fillers), these were 1) str.lower, str.split (str.split is present, but seems to be the javascript split, which works differently to the python version, the behavior of which i was relying on), 2) round (this seems to be supported in the dev version now) and 3) isinstance didn't work on str, int and float, only on dict, list and set. 4) Another difference from Brython i noticed is that if i pull in a JSON representation of a dict, i need to do so using 'myDict = dict(data)', whereas brython was happy with 'myDict = data'. But that might be related to something in Brython's json.loads, which i replaced directly with JSON.parse. 5) Also without specifically enabled Transcrypts operator overloading (using -o switch for global, or
__pragma__('opov')
for local), you can't do things like set operations using the overloaded format, but need to use the corresponding functions. E.g.a = set([1, 2, 3]) b = set([3, 4, 5]) a.difference(b) # is used instead of a - b a.union(b) # used instead of a | b a.intersection(b) # used instead of a & b a.symmetric_difference(b) # used instead of a ^ b
您需要用 javascript 库替换 brython 或 python 标准库。例如,'import json' 是由 Brython 提供的,但在 Transcrypt 下,您可以使用 javascript 库或直接在您的 Python 代码中使用 JSON.parse / JSON.stringify。要在您的 Python 代码中直接包含一个 javascript 库的缩小版本,请使用以下格式(注意三引号):
__pragma__ ('js', '{}', ''' // javascript code ''')
Brython 的 html 特定功能显然不适用于 Transcrypt。只需使用普通的 javascript 方式。示例:1) 在 Brython 下,您可能已经使用“document['id']”引用了特定的 HTML 标签,但是对于 Transcrypt,您将使用“document.getElementById('id')”(这与您使用的方式相同它来自javascript)。2) 您不能删除带有 'del nodeName' 的节点(bcs 这是一个 brython 函数)。使用类似“node.parentNode.removeChild(node)”的东西。3)用javascript替代品替换所有brython的DOM函数。例如 class_name = className; 文本 = 文本内容;html = 内部 HTML;父 = 父节点;children = childNodes 等。我想如果你需要一些包含一些旧浏览器所需的替代品的东西,那么有 javascript 库。4) Brython 的 set_timeout 被 javascripts setTimeout 替换 5) Brython 的 html 标签如 BR() 需要使用普通的 javascript 方式替换,并重做你使用它的 <= dom 操作语法的任何地方。要么将纯文本标记作为innerHTML 注入,要么使用javascript 语法制作元素,然后使用普通的javascript DOM 语法附加它们。我还注意到,对于复选框,brython 使用“if checkbox = 'checked':”但 Transcrypt 对“if checkbox:”感到满意。要么将纯文本标记作为innerHTML 注入,要么使用javascript 语法制作元素,然后使用普通的javascript DOM 语法附加它们。我还注意到,对于复选框,brython 使用“if checkbox = 'checked':”但 Transcrypt 对“if checkbox:”感到满意。要么将纯文本标记作为innerHTML 注入,要么使用javascript 语法制作元素,然后使用普通的javascript DOM 语法附加它们。我还注意到,对于复选框,brython 使用“if checkbox = 'checked':”但 Transcrypt 对“if checkbox:”感到满意。
上周我完成了一个 2700 线的项目,当时 Transcrypt 不支持一些小东西(尽管它们很容易用填充物替换),这些是 1) str.lower, str.split (str. split 存在,但似乎是 javascript split,它的工作方式与 python 版本不同,我依赖的行为),2)round(现在似乎在开发版本中受支持)和 3)isinstance 没有不适用于 str、int 和 float,仅适用于 dict、list 和 set。4) 我注意到与 Brython 的另一个区别是,如果我拉入 dict 的 JSON 表示,我需要使用“myDict = dict(data)”,而 brython 对“myDict = data”感到满意。但这可能与 Brython 的 json.loads 中的某些内容有关,我直接将其替换为 JSON.parse。
__pragma__('opov')
对于local),不能使用重载格式进行set操作之类的操作,而需要使用相应的函数。例如a = set([1, 2, 3]) b = set([3, 4, 5]) a.difference(b) # is used instead of a - b a.union(b) # used instead of a | b a.intersection(b) # used instead of a & b a.symmetric_difference(b) # used instead of a ^ b
6) Also, you can't iterate dicts by default using 'for i in dict:', without enabling that (cmd line -i or __pragma__('iconv')
, but you can avoid having to enable it by just using the keys() member e.g.:
6) 此外,默认情况下您不能使用 'for i in dict:' 迭代 dicts,而不启用它(cmd line -i 或__pragma__('iconv')
,但您可以避免仅使用 keys() 成员来启用它,例如:
for key, value in dict.items():
# do things for each key and value..
To summarise
总结一下
I like Brython because it's easy to get going with it and to test your code (just F5). It's closer to true python because most of the standard lib is there. I dislike having to include the transpilation engine (Edit: Or one might view it as a python VM) in the browser and the large outputted javascript size. If i had to do things over (but still using Brython), i would have used javascript methods to manipulate the DOM from brython (which you can do..), instead of leaning so much on the brython methods because that wasted time moving across to another transpiler when my needs changed.
I like Transcrypt because the outputted javascript is really 'lean and mean' and because the only thing you load browser side is your generated javascript code which is similar in size to your python code. Also because it supports sourcemaps and because it gives me a measure of control over the outputted javascript. And using it taught me quite a bit about optimization.
我喜欢 Brython,因为它很容易上手并测试您的代码(只需 F5)。它更接近真正的python,因为大部分标准库都在那里。我不喜欢在浏览器中包含转译引擎(编辑:或者人们可能会将其视为 python VM)和输出的大 javascript 大小。如果我不得不重新做一些事情(但仍然使用 Brython),我会使用 javascript 方法从 brython 操作 DOM(你可以这样做..),而不是过于依赖 brython 方法,因为那样浪费时间当我的需求改变时到另一个转译器。
我喜欢 Transcrypt,因为输出的 javascript 确实是“精益求精”,并且因为您加载浏览器端的唯一内容是生成的 javascript 代码,它的大小与您的 python 代码相似。还因为它支持源映射,并且因为它让我可以控制输出的 javascript。使用它教会了我很多关于优化的知识。
Hope that helps someone see which of these might be good for their particular project.
希望能帮助某人了解其中哪些可能适合他们的特定项目。
回答by icarito
Since nobody has mentioned it I thought it was worth it to mention Bataviawhich implements the Python virtual machine for running precompiled Python bytecode.
由于没有人提到它,我认为值得一提的是Batavia,它实现了用于运行预编译 Python 字节码的 Python 虚拟机。
I just tried it and, while it's an interesting concept, it is still in early stages as there is little documentation.
我刚刚尝试过,虽然这是一个有趣的概念,但它仍处于早期阶段,因为文档很少。
In the end it will depend on what you are trying to do. I chose Transcryptafter having a look because it was more pragmatic and better performant, also more recently released/maintained.
最后,这将取决于您要尝试做什么。我看了之后选择了Transcrypt,因为它更实用,性能更好,而且最近发布/维护。
回答by user1114907
Not mentioned here is RapydScript or RapydScript-NG. They produce very efficient JavaScript code, which is used in GlowScript VPython (glowscript.org). I used to use the original RapydScript of Alex Tsepkov (https://github.com/atsepkov/RapydScript) but recently switched to RapydScript-NG of Kovid Goyal (https://github.com/kovidgoyal/rapydscript-ng). I recently ran the pystone benchmark on CPython, RapydScript, and Brython, and you can see the results here:
这里没有提到的是 RapydScript 或 RapydScript-NG。它们生成非常高效的 JavaScript 代码,用于 GlowScript VPython (glowscript.org)。我曾经使用 Alex Tsepkov ( https://github.com/atsepkov/RapydScript)的原始 RapydScript,但最近切换到 Kovid Goyal ( https://github.com/kovidgoyal/rapydscript-ng) 的RapydScript-NG 。我最近在 CPython、RapydScript 和 Brython 上运行了 pystone 基准测试,你可以在这里看到结果:
https://groups.google.com/forum/?fromgroups&hl=en#!topic/brython/20hAC9L3ayE
https://groups.google.com/forum/?fromgroups&hl=en#!topic/brython/20hAC9L3ayE
回答by Daian Gan
This is an updated conference which compares all available options in the market right now:
这是一个更新的会议,比较了目前市场上所有可用的选项:
https://www.youtube.com/watch?v=2XSeNQyPlTY
https://www.youtube.com/watch?v=2XSeNQyPlTY
The speaker is Russell Keith-Magee, who is a well known developer in the area.
演讲者是该地区著名的开发商 Russell Keith-Magee。