Skip to content

perf: upgrade wasmtime to 50 and make call_indirect cheaper in wasm plugins - #1389

Merged
dsherret merged 1 commit into
mainfrom
perf/wasmtime-50
Oct 22, 2026
Merged

dsherret merged 1 commit into
mainfrom
perf/wasmtime-50

Conversation

@dsherret

Copy link
Copy Markdown
Member

Upgrades wasmtime from 49.0.2 to 50.0.0 and makes call_indirect cheaper for Wasm plugins:

  • Tables are initialized when a plugin is instantiated (table_lazy_init(false)) rather than lazily on first use, so call_indirect no longer checks whether its table entry has been initialized yet. Plugins compiled from managed languages (for example C# with NativeAOT-LLVM) make a call_indirect for every virtual or interface call, so this check runs constantly.
  • The Spectre mitigation on table accesses is off (enable_table_access_spectre_mitigation). Plugins only receive file text and return text, with no network or file system access, so there's nowhere for a speculative read past a table to leak to.

wasmtime's precompile compatibility hash covers these settings, so cached compiled plugins are recompiled rather than loaded with the old settings.

Measurements

dprint-plugin-prettier (a C# Wasm plugin), one thread, best of three alternating rounds:

Language Before After
JSON 2,425 ms 2,345 ms (−3.3%)
Markdown 2,677 ms 2,618 ms (−2.2%)
SCSS 894 ms 882 ms (−1.3%)
YAML 2,160 ms 2,149 ms (−0.5%)
  • Most of the gain is from initializing tables eagerly: JSON was 3.0% faster with only that, and 2.0% faster with only the Spectre change.
  • wasmtime 50 on its own made no measurable difference.
  • Formatting a single file took the same time with eager initialization (about 155 ms), so instantiation isn't noticeably slower.

…lugins

Initializes function tables when a plugin is instantiated rather than lazily,
so call_indirect doesn't check whether its entry was initialized, and turns off
the spectre mitigation on table accesses, since plugins have no way to send out
what a speculative read could see.
@dsherret
dsherret merged commit e72ea24 into main Oct 22, 2026
5 checks passed
@dsherret
dsherret deleted the perf/wasmtime-50 branch October 22, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant