Stream: git-wasmtime

Topic: wasmtime / PR #13876 Component hostcall optimizations


view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 12:00):

tschneidereit opened PR #13876 from tschneidereit:hostcall-opts to bytecodealliance:main:

This set of commits applies a bunch of independent optimizations to calling host imports from components. In combination, they reduce overhead of sync calls by about 84%, from 83ns to 13ns, and that of immediately-ready async host imports by about 62%, from 142ns to 53ns. All numbers measured in a Linux VM on an M5 Max MBP, but I don't think any of this is particularly architecture-specific.

A few of notes on the results:

  1. I have a change to wit-bindgen pending that reduces guest-side overhead of async calls, bringing the 53ns down to something like 35ns.
  2. The fast paths introduced here only work for calls that don't involve borrows. I have changes pending that expand coverage and improve performance for calls involving borrows, but those need more vetting.
  3. Calls to async functions whose results aren't immediately ready are substantially slower, IIRC the last number I measured was about 700ns. There's more to be done there, but I didn't want to expand scope here too much.

All commits can be reviewed independently and come with improvement numbers relative to the previous commit.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 12:00):

tschneidereit requested dicej for a review on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 12:00):

tschneidereit requested wasmtime-core-reviewers for a review on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 13:05):

github-actions[bot] added the label wasmtime:api on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 13:31):

tschneidereit added the label performance on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 13:32):

tschneidereit added the label wasm-proposal:component-model on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 13:36):

tschneidereit updated PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 13:41):

tschneidereit updated PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 14:29):

alexcrichton commented on PR #13876:

Thanks! Could this be split up to land each commit independently? Some of these I'm more sure about than others and might take more time to review

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 14:29):

alexcrichton unassigned dicej from PR #13876 Component hostcall optimizations.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 14:29):

alexcrichton requested alexcrichton for a review on PR #13876.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 14 2026 at 14:40):

tschneidereit commented on PR #13876:

Happy to do that, yes! I might in that case also restructure some of them a little bit to bring in some borrows-related fixes which change some of the new code again.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 09 2026 at 17:56):

:memo: dishmaker submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 09 2026 at 17:56):

:speech_balloon: dishmaker created PR review comment:

[kinda unrelated to runtime optimizations]
first_poll currently causes a lot of llvm-lines bloat and compile-time overhead.
Do you think it could be reduced by changing generic R to Box<dyn Any + Send + 'static>?

Pin<Box<dyn Future<Output = Box<dyn Any + Send + 'static>> + Send + 'static>>

view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 10:15):

:memo: tschneidereit submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 10:15):

:speech_balloon: tschneidereit created PR review comment:

Do you think it could be reduced by changing generic R to Box<dyn Any + Send + 'static>?

Who knows, maybe? But we'd most certainly have very very compelling evidence that that change doesn't negatively impact runtime performance. Which absent that evidence I would think to be somewhat likely, since it'd introduce a box and a virtual call at a very hot callsite.

This is important to keep in mind for your entire work around reducing the amount of LLVM IR generated: we'd be unlikely to give up even a tiny bit of runtime performance for all but the most massive compile time gains, if at all.


Last updated: Aug 30 2026 at 09:07 UTC