Stream: git-wasmtime

Topic: wasmtime / PR #14753 Share GuestProfiler symbol tables th...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 19:05):

andrewl6097 edited PR #14753.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 19:08):

andrewl6097 edited PR #14753:

Closes #14752

GuestProfiler::new rebuilds and re-demangles each module's symbol table on every call, which costs milliseconds for large modules.

With this change, now the use of the profiler can be, optionally, split into a prepare step (where you make a GuestProfilerModules struct which is an expensive but now one-time operation) separate from the profiling step - where you pass that GuestProfilerModules into the profiler.

The standard GuestProfiler::new just does that internally, so existing callers don't have to change. But - and wasmtime serve does this now - you have the option of disentangling and caching the expensive demangling effort.

Added refs to this in the profiling documentation.

As it seemed practical to mirror this in the C bindings I went ahead and did that as well. I'd be happy to leave wasmtime serve alone if you prefer, but I felt that it would be good to see example code.

Changes

Measurements

Release build, x86_64 Linux, median of 1000 calls, using the issue's reproduction program extended to call the new API. The 1.7 MB module is a real Rust module with about 1,500 functions.

Module Before: new() After: GuestProfilerModules::new (once) After: new_with_modules (per profile)
1,500 functions 663 µs 679 µs 0.95 µs
10,000 functions 4.52 ms 4.63 ms 0.95 µs
Real 1.7 MB module 2.39 ms 2.37 ms 0.95 µs

The per-profile cost no longer depends on how many functions a module has. The previous revision still spent about 8 ns per function on each profile. That was the walk over every function to find the module's text range, which now runs once during preparation.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 19:12):

andrewl6097 commented on PR #14753:

Ok - I pushed a new version that takes a different and more explicit approach. Basically now you can build a modules cache explicitly, then optionally pass that in to the GuestProfiler as an argument, and it'll take that and use it (if you don't, it'll just do that for you internally just-in-time). I updated wasmtime serve to demonstrate this.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 20:47):

github-actions[bot] added the label wasmtime:docs on PR #14753.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 20:47):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 20:53):

:thumbs_up: alexcrichton submitted PR review:

Looks great to me, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 20:53):

alexcrichton added PR #14753 Share GuestProfiler symbol tables through GuestProfilerModules to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 21:31):

:check: alexcrichton merged PR #14753.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2026 at 21:31):

alexcrichton removed PR #14753 Share GuestProfiler symbol tables through GuestProfilerModules from the merge queue.


Last updated: Oct 31 2026 at 23:03 UTC