WasmEdge
WasmEdge copied to clipboard
bug: Different execution time when running a same binary
Summary
I use several runtimes to execute the same randomly generated WASM binary. Although they all report division by zero errors, the execution time of Wasmedge far exceeds that of other runtimes. filea875.zip
Current State
root@4252f5ec38df:a# time /home/sxy/exp/WasmEdge-0.13.5-Linux/bin/wasmedge_0.13.5 --reactor filea875.wasm main
[2023-11-26 04:53:45.660] [error] execution failed: integer divide by zero, Code: 0x84
[2023-11-26 04:53:45.660] [error] In instruction: i32.div_u (0x6e) , Bytecode offset: 0x0000063c , Args: [0 , 0]
[2023-11-26 04:53:45.660] [error] When executing function name: "main"
real 0m51.717s
user 0m51.705s
sys 0m0.008s
root@4252f5ec38df:a# iwasm --version
iwasm 1.2.3
root@4252f5ec38df:a# time iwasm --heap-size=0 -f main --llvm-jit filea875.wasm
Exception: integer divide by zero
real 0m2.694s
user 0m2.689s
sys 0m0.012s
root@4252f5ec38df:a# time ./wasmtime_14.0.4 --invoke main filea875.wasm
Error: failed to run main module `filea875.wasm`
Caused by:
0: failed to invoke `main`
1: error while executing at wasm backtrace:
0: 0x63c - <unknown>!<wasm function 10>
1: 0x6cb - <unknown>!<wasm function 11>
2: 0x7f2 - <unknown>!<wasm function 12>
2: wasm trap: integer divide by zero
real 0m13.017s
user 0m13.006s
sys 0m0.008s
Expected State
I hope Wasmedge can execute this WASM binary in under 10 seconds.
Reproduction steps
wasmedge --reactor filea875.wasm main
iwasm --heap-size=0 -f main --llvm-jit filea875.wasm
wasmtime --invoke main --invoke main filea875.wasm
Screenshots
No response
Any logs you want to share for showing the specific issue
No response
Components
CLI
WasmEdge Version or Commit you used
wasmedge version 0.13.5
Operating system information
Docker version 24.0.5, build ced0996
Hardware Architecture
Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-79-generic x86_64)
Compiler flags and options
No response
This file also takes 35 seconds on MacOS, I think this is related to #2482, for now I think you can use AOT mode, which only takes 1 second on my machine.
wasmedge compile filea875.wasm filea875_aot.wasm
wasmedge filea875_aot.wasm main
AOT mode take only 1~2 seconds.