dirkschumacher / polyglotr

Use C, Rust, Go and Assemblyscript in an R package through WebAssembly
Other
10 stars 1 forks source link

Did you try LLVM JIT backend option for wasmr? #2

Open MaxGraey opened 5 years ago

MaxGraey commented 5 years ago

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.

MaxGraey commented 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

dirkschumacher commented 5 years ago

Both good ideas. Thanks

dirkschumacher commented 5 years ago

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.

MaxGraey commented 5 years ago

Yeah, now much better! Also interesting to see result with LLVM JIT backend =)