Stream: git-wasmtime

Topic: wasmtime / PR #3739 Lazily allocate the bump-alloc chunk ...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 20:29):

alexcrichton opened PR #3739 from less-alloc to main:

This commit updates the allocation of a VMExternRefActivationsTable
structure to perform zero malloc memory allocations. Previously it would
allocate a page-size of chunk plus some space in hash sets for future
insertions. The main trick here implemented is that after the first gc
during the slow path the fast chunk allocation is allocated and
configured.

The motivation for this PR is that given our recent work to further
refine and optimize the instantiation process this allocation started to
show up in a nontrivial fashion. Most modules today never touch this
table anyway as almost none of them use reference types, so the time
spent allocation and deallocating the table per-store was largely wasted
time.

Concretely on a microbenchmark this PR speeds up instantiation of a
module with one function by 30%, decreasing the instantiation cost from
1.8us to 1.2us. Overall a pretty minor win but when the instantiation
times we're measuring start being in the single-digit microseconds this
win ends up getting magnified!

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 20:29):

alexcrichton requested fitzgen for a review on PR #3739.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 20:52):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 20:52):

bjorn3 created PR review comment:

*actual

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 21:01):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 21:24):

alexcrichton updated PR #3739 from less-alloc to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 28 2022 at 22:10):

alexcrichton merged PR #3739.


Last updated: Nov 22 2024 at 17:03 UTC