MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / main

Function main

examples/fast_compilation.rs:8–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6use wasmtime::{Cache, Config, Engine, Result, Strategy};
7
8fn main() -> Result<()> {
9 let mut config = Config::new();
10
11 // Enable the compilation cache, using the default cache configuration
12 // settings.
13 config.cache(Some(Cache::from_file(None)?));
14
15 // Enable Winch, Wasmtime's baseline compiler.
16 config.strategy(Strategy::Winch);
17
18 // Enable parallel compilation.
19 config.parallel_compilation(true);
20
21 // Build an `Engine` with our `Config` that is tuned for fast Wasm
22 // compilation.
23 let engine = Engine::new(&config)?;
24
25 // Now we can use `engine` to compile and/or run some Wasm programs...
26
27 let _ = engine;
28 Ok(())
29}

Callers

nothing calls this directly

Calls 5

OkFunction · 0.85
newFunction · 0.50
cacheMethod · 0.45
strategyMethod · 0.45
parallel_compilationMethod · 0.45

Tested by

no test coverage detected