4 ms·
even more specifically, 3 times faster than wasmer's build of cpython (whatever that is), running on their runtime. i'd be curious to see this benchmark extend
by 5- 2y ago
even more specifically, 3 times faster than wasmer's build of cpython (whatever that is), running on their runtime.
i'd be curious to see this benchmark extended, as in my own experience toying with python-like interpreters, you get ~2x slowdown (like their end result) from just compiling to wasm/wasi with clang and running in any 'fast' runtime (e.g. node or wasmtime).
- deleted 2y ago[deleted]
- syrusakbary 2y agoHey, I'd love to reproduce the ~2x slowdown you commented from running the workload in Native CPython compared to Wasm CPython (in any runtime, browser or outside). Any tip would be helpful so we can debug it. If your claims are accurate, we can easily get py2wasm even running faster than native CPython! Note: we benchmarked in a M3 Max laptop, so maybe there's some difference there?
- deleted 2y ago[deleted]
- kelp 2y agoHere is a trivial example, also on a M3 Max: cat hello.py print("Hello, Wasm!") time python3 ./hello.py Hello, Wasm! ________________________________________________________ Executed in 26.86 millis fish external usr time 16.37 millis 0.13 millis 16.24 millis sys time 7.25 millis 1.14 millis 6.11 millis time wasmer hello.wasm Hello, Wasm! ________________________________________________________ Executed in 84.77 millis fish external usr time 50.26 millis 0.14 millis 50.12 millis sys time 28.97 millis 1.21 millis 27.76 millis time wasmtime hello.wasm Hello, Wasm! ________________________________________________________ Executed in 141.72 millis fish external usr time 120.86 millis 0.13 millis 120.72 millis sys time 16.65 millis 1.20 millis 15.45 millis
- 5- 2y agonote that i'm not claiming 2x slowdown for cpython. but here's one test i've run just now: using your test file, i've run this one-liner on my x86_64 linux laptop in https://pyodide.org/en/stable/console.html https://pyodide.org/en/stable/console.html in chromium (v8) and natively (pyodide's urllib doesn't handle https for some reason): import requests;exec(requests.get('https://gist.githubusercontent.com/syrusakbary/b318c97aaa8de6e8040fdd5d3995cb7c/raw/1c6cc96cf98bd7bd41c81ba9d10dc4d19b1c3e53/pystone.py').text) native: ~470k pyodide: ~200k i.e. ~2.4x slowdown
- syrusakbary 2y agoThanks! That should help us a lot to investigate further the difference in timing. I remember trying the py2wasm strategy about 4 years ago, and I got it running faster than native CPython, so there must be something we are missing!