4 ms·
> It might make sense to develop a compiler that translates Python code directly to WebAssembly and sacrifice some compatibility for performance. This seems to
by pansa2 6y ago
> It might make sense to develop a compiler that translates Python code directly to WebAssembly and sacrifice some compatibility for performance.
This seems to be the author's preferred approach, but I'm not sure it would provide significant performance improvements over simply compiling the existing Python interpreter to WebAssembly.
Compiling dynamically-typed Python to statically-typed WebAssembly would be similar to how Nuitka [0] compiles Python to C. This compiled code may be a little faster than interpreted Python, but it's still going to be quite slow - much slower in a browser than JIT-compiled JavaScript.
AFAIK the ideal way to maximize the performance of Python in the browser would be to JIT-compile Python code to WebAssembly. Are WebAssembly implementations able to support that?
[0] http://nuitka.net/ http://nuitka.net/