Stream: wasmtime

Topic: Build Times - C dynamic library wrapper?


view this post on Zulip theduke (Oct 11 2021 at 21:48):

Wasmtime is a pretty heavy dependency and slows down build and link times a lot when embedded into other projects.

This is of course expected, it contains a full compiler and runtime.

But it's really quite annoying during development, especially in a larger project where the wasm engine is only a smaller part of functionality.
wasmtime also pretty much has to be built with a higher opt level or it will be way to slow if testing includes running wasm code.

Has anyone considered re-wrapping the C API in Rust bindings that remain as faithful as possible to the actual Rust API?
That way during development wasmtime could be built once as a dynamic library (with optimizations) and then linked.
This could speed up incremental builds a lot.

And release builds can switch back to using the actual Rust library.

view this post on Zulip Alex Crichton (Oct 11 2021 at 22:13):

AFAIK no one's done this but it's something I've wondered whether it makes sense before. This would be some tricky automation to get everything sync'd up right and feed it into the release process, but I don't think that it's unheard of and it's not like it's impossible. FWIW for the opt-level you can optimize the cranelift-codegen crate in Cargo which would probably get the lion's share of the benefit


Last updated: Dec 23 2024 at 14:03 UTC