Open MaxGraey opened 5 years ago
Also could you separate instantiate module and actual method's call? instead:
fib_c <- function(n) {
check_input(n)
make_fib_fun("fib_c.wasm")(n)
}
use something like:
fib_c_fn <- make_fib_fun("fib_c.wasm") # cache this on top level
fib_c <- function(n) {
fib_c_fn(n)
}
# ...
# same for rest
or simply
fib_c <- make_fib_fun("fib_c.wasm")
also check_input
is unnecessary
Both good ideas. Thanks
Now the package instantiates the modules when the package is loaded. The C API of wasmer does not support different backends it seems, but I can write something in rust. Would be interesting to try it.
Yeah, now much better! Also interesting to see result with LLVM JIT backend =)
I know wasmer.io support different jit backends: Cranelift (default), LLVM JIT and dynasm. I don't familiar with wasmr (wasmer port for R) but I guess it should be able setup LLVM backend. It should be much faster than Cranelift.