WasmtimeRuntime should cache compiled modules #14

Closed
opened 2022-10-30 06:10:10 +00:00 by mars · 0 comments
Owner

JIT compilation is slow. WasmtimeRuntime should cache compiled Wasm modules, both on disk (by enabling Wasmtime's built-in disk caching system) and in memory.

To avoid storing large Wasm sources in memory as keys in a HashMap, we should use the prehash crate to hash our module sources into an u64 key before entering them into the cache.

Because compiled Wasm modules are very large, we may need a reaper to clean old cache entries if the cache takes up too much memory. I'm not sure how best to gauge used memory without serializing the compiled modules. As always, profile first!

JIT compilation is slow. `WasmtimeRuntime` should cache compiled Wasm modules, both on disk (by enabling Wasmtime's [built-in disk caching system](https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.cache_config_load_default)) and in memory. To avoid storing large Wasm sources in memory as keys in a `HashMap`, we should use the `prehash` crate to hash our module sources into an `u64` key before entering them into the cache. Because compiled Wasm modules are very large, we may need a reaper to clean old cache entries if the cache takes up too much memory. I'm not sure how best to gauge used memory without serializing the compiled modules. As always, profile first!
roux was assigned by mars 2022-10-30 06:32:26 +00:00
mars added the
performance
label 2022-11-01 06:23:48 +00:00
mars closed this issue 2022-11-26 00:54:26 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: canary/canary-rs#14
No description provided.