Stream: git-wasmtime

Topic: wasmtime / issue #7733 Performance issue related to incre...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 28 2023 at 14:53):

ShuyaoJiang opened issue #7733:

Summary

Hi, I ran the attached case (C program, compiled to Wasm by Emscripten) in different Wasm runtimes, and found abnormal performance in Wasmtime compared with other runtimes. The execution time of this case (time interval from the start to the end of the execution of Wasm bytecode running command) on different runtimes is as follows:

We found that in most other test cases, Wasmtime can achieve similar performance (1-2x) with the other two runtimes. However, in this case, Wasmtime is about 10x slower than the other two runtimes.

Emscripten

Wasm Runtime Version

Hardware & OS

Additional details

The attached source program is synthesized by a Csmith seed and a code snippet from another program. The inserted code snippet is on lines 2386-2388 of the source program, which is an increment operation in nested loops. So, we think that this abnormal performance may be caused by this operation. Could you please check this situation? Thank you!

1702317926850.zip

view this post on Zulip Wasmtime GitHub notifications bot (Dec 28 2023 at 17:39):

tschneidereit commented on issue #7733:

Hi @ShuyaoJiang, thank you for filing this and the other performance issues, much appreciated!

Would it be possible to also share (for this and the other issues you filed) the exact commands you used to compile the code, and also to execute the resulting .wasm file in all of the runtimes? That'd greatly help us in investigating what's going on.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 29 2023 at 08:00):

ShuyaoJiang commented on issue #7733:

Hi, here are the commands I used:

Compile

emcc -O2 -s WASM=1 -s TOTAL_MEMORY=512MB -I/home/ubuntu/csmith/include <C_PROGRAM> -o <WASM_TARGET>
/home/ubuntu/.wasmedge/bin/wasmedgec <WASM_TARGET> <WASMEDGE_AOT_TARGET(.wasm)>
/home/ubuntu/wasm-micro-runtime/wamr-compiler/build/wamrc -o <WAMR_AOT_TARGET(.aot)> <WASM_TARGET>

Execute .wasm file (the execution time is collected in this phase)

/home/ubuntu/.wasmtime/bin/wasmtime <WASM_TARGET>
/home/ubuntu/.wasmer/bin/wasmer run <WASM_TARGET>
/home/ubuntu/.wasmedge/bin/wasmedge <WASMEDGE_AOT_TARGET(.wasm)>
/home/ubuntu/wasm-micro-runtime/product-mini/platforms/linux/build/iwasm <WAMR_AOT_TARGET(.aot)> <WASM_TARGET>

view this post on Zulip Wasmtime GitHub notifications bot (Jan 02 2024 at 19:53):

fitzgen commented on issue #7733:

This is measuring compilation time as well, you can separate the phases via

$ wasmtime compile foo.wasm
$ wasmtime run --allow-precompiled foo.cwasm

When you separate the compilation and execution phases are you still seeing Wasmtime as 10x slower?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 26 2024 at 22:08):

alexcrichton commented on issue #7733:

Ok I've dug into this in the same manner as https://github.com/bytecodealliance/wasmtime/issues/7732#issuecomment-1909132554 and I've at least locally confirmed that v8 takes ~2ms to execute this file and Wasmtime takes ~350us. In that sense I suspect that the 100ms+ times reported in the OP were probably including the compilation time for the module.

I'm hesitant to go ahead and close this to ensure you can confirm that when separating out the compilation phase you get expected timings, however.


Last updated: Nov 22 2024 at 17:03 UTC