▲ | singularity2001 5 days ago | |||||||
one wasmtime dependency and a self contained python file with 100 loc seems reasonable! much better than calling deno, at least if you have no pip dependencies... just had to update to new api: # store.add_fuel(fuel) store.set_fuel(fuel) fuel_consumed=fuel-store.get_fuel() and it works!! time to hello world: hello_wasm_python311.py 0.20s user 0.03s system 97% cpu 0.234 total | ||||||||
▲ | antonvs 5 days ago | parent | next [-] | |||||||
I was interested in how this compares in a kind of absolute sense. For comparison, an optimized C hello world program gave these results using `perf` on my Dell XPS 13 laptop:
That's 36,800% faster. Hand-written assembly was very slightly slower. Using the standard library for output instead of a syscall brought it down to 20,900% faster.(Yes I used percentages to underscore how big the difference is. It's 368x and 209x respectively. That's huge.) Begrudgingly, here are the standard Python numbers:
About 1230% faster than the sandbox, i.e. 12.3x. About an order of magnitude, which is typical for these kinds of exercises. | ||||||||
| ||||||||
▲ | lopuhin 5 days ago | parent | prev | next [-] | |||||||
it's pretty difficult to package native python dependencies for wasmtime or other wasi runtimes, e.g. lxml | ||||||||
| ||||||||
▲ | fzzzy 5 days ago | parent | prev [-] | |||||||
Great, thanks for your post! I got it working too. This is going to be incredibly handy. |