(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=39286458
虽然 Python 在易于学习和用于脚本编写方面确实具有一定的实际优势,但由于性能和可扩展性等方面的限制,它无法取代其他高级通用编程语言,例如 Java、C++ 或 Rust 。 These languages have advantages in handling resource-intensive and large-scale applications, which Python typically lacks。 While Python remains useful and beneficial in its domain, limiting oneself to it for more advanced programming needs limits flexibility and innovation。 Ultimately, choosing a language ultimately depends on individual needs and preferences。
I have seen this approach with C-python and NodeJS already and I think it simply not viable, what they are suggesting is compiling the runtime (the same one you use in non-wasm projects) to wasm and then run your python code on top of it.
This is a double-whammy of performance degradation, you basically have two JIT-compilation steps happening (once by the wasm runtime to compile the rust-python wasm and again by the rust-python code compiling your python code). And this is on top of normal performance degradation from using a dynamically typed language compared to a statically typed language
To make dynamic languages (even JS) viable to run in a wasm runtime, the language must be compiled directly to wasm.
Project still looks pretty cool and useful though, there is plenty of python code that could be useful to use in the browser no matter how badly it runs. Just don't try to build a web framework on top of this kind of approach.
Edit: Let me reframe this a bit, this is what I think, I haven't really benchmarked anything and rust python might be doing some tricks I am not aware of.
reply