wasmedge command line tool will execute the original WASM files in interpreter mode. For the much better performance, we recommand users to compile the WASM with the
wasmedgec AOT compiler to execute the WASM in AOT mode. There are 2 output formats of the AOT compiler:
By default, the
wasmedgec AOT compiler tool could wrap the AOT-compiled native binary into a custom section in the origin WASM file. We call this the universal WASM binary format.
This AOT-compiled WASM file is compatible with any WebAssembly runtime. However, when this WASM file is executed by the WasmEdge runtime, WasmEdge will extract the native binary from the custom section and execute it in AOT mode.
Note: On MacOS platforms, the universal WASM format will
bus errorin execution. It's because the
wasmedgectool optimizes the WASM in
O2level by default. We are trying to fix this issue. For working around, please use the shared library output format instead.
wasmedgec app.wasm app_aot.wasm wasmedge app_aot.wasm
Users can assign the shared library extension for the output files (
.so on Linux,
.dylib on MacOS, and
.dll on Windows) to generate the shared library output format output.
This AOT-compiled WASM file is only for WasmEdge use, and cannot be used by other WebAssembly runtimes.
wasmedgec app.wasm app_aot.so wasmedge app_aot.so