Conversation
|
|
||
| #[cfg_attr(all(target_arch = "wasm32"), export_name = "run_vrl_wasm")] | ||
| #[no_mangle] | ||
| pub unsafe extern "C" fn run_vrl(ptr: u32, len: u32) -> u32 { |
There was a problem hiding this comment.
The step that is currently being slow is the module instantiation Module::from_file.
If you remove this run_vrl function and compile new wasm, then module instantiation becomes very quick.
I'm not quite sure why, but without this function all of the VRL bits become dead code and will be optimized away, and from a brief look at a profile it seems to spend most of its time actually compiling (eg, I see lots of calls to regalloc2::compute_liveness).
I'm not sure why I don't see similar slowness when instantiating the module in the cgo-rust project, so maybe a starting point would be to use the wasm bytes from the cgo-rust project and try to load them with the Rust api?
Both wasm bytes contain VRL and are compiled using wasmtime, so I'd expect them to be very similar
some reason is slow