Skip to content

Conversation

jonathanpv
Copy link
Collaborator

some reason is slow


#[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 {
Copy link
Owner

@scottopell scottopell Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants