Naive side by side performance comparison of unmemoized Fibonacci number calculations. Serves to demonstrate how to compile C function to WebAssembly and call it from JS without emscripten runtime.
yarn install
docker build -t wasm-load-module-example .
docker cp $(docker run -d wasm-load-module-example):/usr/src/fib.wasm ./src/
yarn start
Get inside docker container:
docker run -it wasm-load-module-example bash
Once inside check WAST:
root@66cd9754dbf5:/usr/src# wasm-dis fib.wasm
(module
(type $0 (func (param i32) (result i32)))
(type $1 (func (result i32)))
(global $global$0 (mut i32) (i32.const 2752))
(export "_fibC" (func $0))
(export "_main" (func $1))
(export "stackAlloc" (func $2))
...
Compiling a New C/C++ Module to WebAssembly