I guess not much can be done at the moment: dependencies are often the primary obstacle in porting crates to new targets, and just comparing the list of dependencies of wasmtime vs wasmi gives a pretty good indication of which crate is a bit more careful in this regard:
https://crates.io/crates/wasmtime/33.0.0/dependencieshttps://crates.io/crates/wasmi/0.47.0/dependencies
How is the performance when using fuel with wasmi?
We are considering to use epoch counter, but for now we just turned fuel off.
More info: https://github.com/bytecodealliance/wasmtime/issues/8036 Several folks have volunteered work on the C bindings over the last year or two, with this contributor making progress most recently: https://github.com/bytecodealliance/wasmtime/pulls?q=is%3Apr...
match Plugin::instantiate_async(&mut store, &component, &linker).await {
Ok(plugin) => {
match plugin
.plugin_guest_oncallback()
.call_ontimedcallback(&mut store, &callback_name)
.await
{
Ok(()) => debug!("Successfully called oncallback for {plugin_path:?}"),
Err(e) => warn!("Failed to call oncallback for {plugin_path:?}: {e}"),
}
}
Err(e) => {
error!("Failed to call oncallback for {plugin_path:?}!: {e}");
}
}
See the "call_ontimedcallback"? It's not a string. The compiler ensures it exists on the Plugin type generated from the .wit file.If of course I put a wasm file in the plugin folder that doesn't adhere to that definition, that wasm file isn't considered a plugin.
To elaborate a bit further: wasmtime ships a [bindings generator proc macro](https://docs.wasmtime.dev/api/wasmtime/component/macro.bindg...) that takes a wit and emits all the code wasmtime requires to load a component and use it through those wit interfaces. It doesn’t just check the loaded component for the string names present: it also type checks that all of the types in the component match those given by the wit. So, when you call the export functions above, you can be quite sure all of the bindings for their arguments, and any functions and types they import, all match up to Rust types. And your component can be implemented in any language!
This platform is also based on wasmtime and wasmtime's wasi-http implementation, which I authored, so I'm really proud to see it reused here!
One more plug: I've been working on https://github.com/yoshuawuyts/wstd/ with Yosh and Dan Gohman (creator of WASI) as a nice way to write wasi-http guests in Rust.
What are the min memory requirements for wasmtime/cranelift?
I have run wasmtime on the esp32 microcontrollers with plenty of ram to spare, but I don’t have a measurement handy.