Open hungryzzz opened 1 year ago
Thank you for this detailled ticket. Interresting findings. Can you please try again with the just released 3.2.0 version of wasmer? Also, it would be interresting to see if building the same program with the wasi sdk instead of emscripten change performances somehow.
Hi, I try again in the 3.2.0 version of wasmer and the 3 execution times are as follow:
Almost the same result as the above report.
Ok, so no changes basicaly.
Yes, and I compile the same program using wasi-sdk-20.0, the result is still the same.
ok, thanks for all those tests. So, it's slow access to stdout/stderr? Strange. @john-sharratt is that a normal behaviour?
We don't have a fast path for vectorized IO in the VirtualFile
implementation, which might be part of the slowness.
But it's more likely that the asyncify
wrapper and the async runtime are a significant contributor.
It would probably be helpful to run a stress test with cargo-flamegraph
to get some insight.
I'm not so sure, because the slowiness was there with 3.2.0-alpha.1, and I don't think async with present at this time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Feel free to reopen the issue if it has been closed by mistake.
Summary
Hi, I run the following case in different Wasm runtimes(after being compiled by
Emscripten
), and I find some performance differences betweenwasmer
and other 3 runtimes: the execution time(collected by perf-tool, probe begins when starting to execute the wasm code(inner_module_run
inwasmer
) and end insched:sched_process_exit
) inwasmer
is 4x slower than which inwasmtime
.Hardware & OS
Emscripten
Wasm runtime version
Additional details
I find that if I comment the IO(printf) in source code, the execution time of
wasmer
will be faster thanwasmtime
, so I try to replace thefd_write
function to an empty function in the wasm binary just as following.The execution times are totally changed. Because there is an another wasi call (
clock_time_get
) in this loop, I think the bug doesn't exist in the mechanism of calling a wasi call.Then, I try to comment the following code(change the written size to a fix value according to my case) and rebuild wasmer, the execution time of the original case is 8675.32 us. https://github.com/wasmerio/wasmer/blob/8a343d0f9a1d3d4b4bfe622ed345253d780a3d76/lib/wasi/src/syscalls/wasi/fd_write.rs#L132-L147
Therefore, I think maybe there are some performance bugs in the implementation of
fd_write
, especially in the above code.