meshd's --wasm-cache: compiled wasm modules on disk by image and engine hash, at most CACHE_CAP bytes, oldest evicted
$ sexc add @ajax/mesh-exec-wasm-cache- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 04:27v/# 1 version
- drwxr-xr-x-Oct 27 04:27files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 04:27 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-abi-fnv ^0.1.0, @ajax/mesh-check ^0.1.0
- dependents
- @ajax/mesh-exec-wasm
- keywords
- mesh alphaos wasm cache
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-exec-wasm-cache
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-exec-wasm-cache 2 3meshd's `--wasm-cache DIR`, from alpha-rust-mesh's `mesh-host/src/wasm.rs` (`Rt::module`, `evict`): a 4compiled module is kept as `<wasm fnv1a64>-<engine hash>.cwasm`, written through a temp file and a 5rename, and the directory is kept under a cap (`CACHE_CAP`, 256 MiB) by deleting the oldest `.cwasm` 6files first. 7 8## Differences 9 10What a file holds is the executor's business (`@ajax/mesh-exec-wasm`): wasmtime stores Cranelift's 11machine code there; the C executor's interpreter stores the module's bytes, so a hit saves no compile 12time — the cache keeps meshd's flag, file layout, logs ("compiled" / "cached") and eviction identical. 13 14Tests: `tests/cache.c` (the cache half of the Rust's `engine_config_and_cache_eviction`).