enabled wasmtime built in caching
This commit is contained in:
parent
b3c60eb73f
commit
05d68ab3c1
|
@ -13,12 +13,14 @@ type Linker = wasmtime::Linker<ScriptAbiImpl>;
|
|||
pub struct WasmtimeBackend {
|
||||
engine: wasmtime::Engine,
|
||||
}
|
||||
|
||||
impl WasmtimeBackend {
|
||||
pub fn new() -> anyhow::Result<Self> {
|
||||
let mut config = wasmtime::Config::new();
|
||||
config.wasm_simd(true);
|
||||
config.wasm_bulk_memory(true);
|
||||
config.cranelift_opt_level(wasmtime::OptLevel::Speed);
|
||||
config.cache_config_load_default()?;
|
||||
|
||||
let engine = wasmtime::Engine::new(&config)?;
|
||||
|
||||
|
@ -26,7 +28,9 @@ impl WasmtimeBackend {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
impl Backend for WasmtimeBackend {
|
||||
|
||||
fn load_module(&self, module: &[u8]) -> anyhow::Result<Arc<dyn Instance>> {
|
||||
let module = wasmtime::Module::new(&self.engine, module)?;
|
||||
let abi = ScriptAbiImpl::default();
|
||||
|
|
Loading…
Reference in New Issue