Stream: git-wasmtime

Topic: wasmtime / PR #13843 Remove `ensure_trace_info` methods


view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 21:16):

alexcrichton opened PR #13843 from alexcrichton:no-ensure-trace-info to bytecodealliance:main:

This commit removes all ensure_trace_info methods from all GC
collectors, the GC store, etc. The goal of this commit is to accelerate
instantiation of modules that use GC by avoiding using the read-write
lock on the TypeRegistry stored within the engine. As shown in https://github.com/bytecodealliance/wasmtime/pull/13822
even in read-only situations this comes with a significant performance
penalty.

The strategy taken in this commit is to take an alternative route of
handling trace information, empowered by the previous commit. Notably
trace information is now all available at Module-creation time, for
example, and need not be re-calculated for each store. The main
difficulty is then looking up this trace information at runtime when a
GC is performed. This commit implements functionality where TraceInfos
is repurposed as a cache rather than a storage table. The cache stores
where the trace information is located, and then trace information is
looked up where it lies at-rest within a Module or RegisteredType.

This means that the first time a type is traced within a store it
requires a search to determine where the trace information is located.
Right now this involves two locations:

The TraceInfos cache is intended to amortize this cost of a lookup.
This lookup is additionally mitigated in the copying collector where
this is only required for "big structs" where their tracing information
can't be stored inline in the object header itself. Overall it's
expected that for the copying collector this change has little effect on
typical GC performance itself.

Additionally overall, however, this eliminates usage of the read/write
lock in the TypeRegistry entirely during instantiation. Eliminating
this lock acquisition was the goal of this commit, and this is expected
to help improve parallel instantiation performance of GC-using modules.

Note: this is currently built on #13842

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 21:16):

alexcrichton requested fitzgen for a review on PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 21:16):

alexcrichton requested wasmtime-core-reviewers for a review on PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 21:38):

alexcrichton updated PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 21:38):

alexcrichton updated PR #13843.

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

alexcrichton requested wasmtime-default-reviewers for a review on PR #13843.

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

alexcrichton updated PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 22:17):

alexcrichton updated PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 22:55):

alexcrichton updated PR #13843.

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

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

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

github-actions[bot] added the label wasmtime:ref-types on PR #13843.

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

github-actions[bot] commented on PR #13843:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

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

alexcrichton updated PR #13843.

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

alexcrichton edited PR #13843:

This commit removes all ensure_trace_info methods from all GC
collectors, the GC store, etc. The goal of this commit is to accelerate
instantiation of modules that use GC by avoiding using the read-write
lock on the TypeRegistry stored within the engine. As shown in https://github.com/bytecodealliance/wasmtime/pull/13822
even in read-only situations this comes with a significant performance
penalty.

The strategy taken in this commit is to take an alternative route of
handling trace information, empowered by the previous commit. Notably
trace information is now all available at Module-creation time, for
example, and need not be re-calculated for each store. The main
difficulty is then looking up this trace information at runtime when a
GC is performed. This commit implements functionality where TraceInfos
is repurposed as a cache rather than a storage table. The cache stores
where the trace information is located, and then trace information is
looked up where it lies at-rest within a Module or RegisteredType.

This means that the first time a type is traced within a store it
requires a search to determine where the trace information is located.
Right now this involves two locations:

The TraceInfos cache is intended to amortize this cost of a lookup.
This lookup is additionally mitigated in the copying collector where
this is only required for "big structs" where their tracing information
can't be stored inline in the object header itself. Overall it's
expected that for the copying collector this change has little effect on
typical GC performance itself.

Additionally overall, however, this eliminates usage of the read/write
lock in the TypeRegistry entirely during instantiation. Eliminating
this lock acquisition was the goal of this commit, and this is expected
to help improve parallel instantiation performance of GC-using modules.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:06):

:thumbs_up: fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:06):

:speech_balloon: fitzgen created PR review comment:

Can we put this stuff in GcStore? It is already intended to be the store-specific GC data.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:08):

alexcrichton added PR #13843 Remove ensure_trace_info methods to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:09):

:memo: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:09):

:speech_balloon: alexcrichton created PR review comment:

I'll look into that as a follow-up, yeah. I agree we should probably be able to though

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:34):

:check: alexcrichton merged PR #13843.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 16:34):

alexcrichton removed PR #13843 Remove ensure_trace_info methods from the merge queue.


Last updated: Jul 29 2026 at 05:03 UTC