3 ms·
The WebAssembly version of this exact test takes about twice as long as running natively. I just happened to do exactly this benchmark a few minutes ago: Pyt
by williamstein 4y ago
The WebAssembly version of this exact test takes about twice as long as running natively. I just happened to do exactly this benchmark a few minutes ago:
Python 3.11.0 native: 0m43.755s
Python 3.11.0 WebAssembly (on node.js): 1m31.305s (about 2.1x as long).
For what it is worth, I also maintain a Python --> Javascript transpiler (https://www.npmjs.com/package/pylang https://www.npmjs.com/package/pylang) and I tried it on exactly this benchmark (with some very minor changes):
PyLang: 0m19.386s (on node.js) about half as long as Python 3.11.0 native
The article uses bun, which uses Safari's JS runtime, which sometimes has significantly better performance than node.js for these sorts of benchmarks (especially for Webassembly), in my experience.
These tests were all on an M1 Macbook Pro.