You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugins: every invocation re-faults the guest's linear memory — expose linear_memory_keep_resident on the pooling allocator #376
Each plugin invocation instantiates a fresh Store from the cached InstancePre with the pooling allocator — cheap — but the pool is configured without linear_memory_keep_resident (plugin/runtime.rs:148, wasmtime default 0), so when an instance is returned its linear memory is reset with madvise and every page the guest touches is faulted in again on the next call.
For a game-engine style plugin called twice per turn (observe, step), each call decodes a ~20–30 KB state, allocates its working bitmaps and builds a JSON answer — the same pages every call.
Measured
Per call in a real loop: observe 0.77 ms, step 0.47 ms mean (plugin_invocation_duration). A native host of the same component (wasmtime, instantiate per call, no pooling) spends ~30–50 µs per call just instantiating.
Proposal
Expose [plugins] linear_memory_keep_resident_bytes (and table_keep_resident) on the pooling config, defaulting to something like the first few MiB, so a warm slot keeps its hot pages. Related and smaller, while here: the resolved input is re-validated against the function's schema and round-tripped through serde_json strings on every call (plugin/handler.rs:157-208) — worth measuring alongside.
Fixed in 61fa233 on branch fix/issues-369-377 (not yet pushed; it lands after PR #368). [plugins] linear_memory_keep_resident_bytes (default 1 MiB) and table_keep_resident_bytes (default 64 KiB) set the pooling allocator's keep-resident sizes, with env overrides, docs and a check against max_memory_bytes. Linux only; not measured here (macOS), so worth confirming on the loop that reported it. The per-call JSON round-trip is the plugin ABI itself and was left as is.
Activity
codetiger commentedon Oct 1, 2026
Fixed in 61fa233 on branch
fix/issues-369-377(not yet pushed; it lands after PR #368).[plugins] linear_memory_keep_resident_bytes(default 1 MiB) andtable_keep_resident_bytes(default 64 KiB) set the pooling allocator's keep-resident sizes, with env overrides, docs and a check againstmax_memory_bytes. Linux only; not measured here (macOS), so worth confirming on the loop that reported it. The per-call JSON round-trip is the plugin ABI itself and was left as is.fix: the five Orion-side issues from the turn-loop profiling (#369, #370