tetratelabs / wazero

wazero: the zero dependency WebAssembly runtime for Go developers

Home Page:https://wazero.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Compilation cache over different versions

ayuhito opened this issue · comments

commented

The contents written into dirname are wazero-version specific, meaning different versions of wazero will duplicate entries for the same input wasm.

Reference

Just for clarification. Does this mean different Wazero versions will overwrite these caches for the same input WASM or it is the developer's responsibility to clear the cache before running when the version is changed? I'm building a CLI tool that is a version manager so caches might get invalidated quite frequently in this case.

A new (sub-)directory is created for every wazero version:

dirname := path.Join(dir, "wazero-"+wazeroVersion+"-"+goruntime.GOARCH+"-"+goruntime.GOOS)

Within that folder, each module is keyed by a sha256 hash of the Wasm and some other stuff.

You may want to eventually cleanup old directories and/or modules.