...

Text file src/github.com/tetratelabs/wazero/examples/multiple-runtimes/README.md

Documentation: github.com/tetratelabs/wazero/examples/multiple-runtimes

     1## Multiple runtimes
     2
     3Sometimes, a Wasm module might want a stateful host module. In that case, we have to create
     4multiple `wazero.Runtime` if we want to run it multiple times.
     5This example shows how to use multiple Runtimes while sharing
     6the same compilation caches so that we could reduce the compilation time of Wasm modules.
     7
     8In this example, we create two `wazero.Runtime` which shares the underlying cache, and
     9instantiate a Wasm module which requires the stateful "env" module on each runtime.
    10
    11```bash
    12$ go run counter.go
    13m1 count=0
    14m2 count=0
    15m1 count=1
    16m2 count=1
    17```

View as plain text