by syrusakbary · 2y ago · 0 comments
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?
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 millisbut 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 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: ~470kpyodide: ~200k
i.e. ~2.4x slowdown
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!