Stream: git-wasmtime

Topic: wasmtime / PR #3319 Optimize `Func::call` and its C API


view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 21:27):

alexcrichton opened PR #3319 from optimize-call-take-two to main:

This commit is an alternative to #3298 which achieves effectively the
same goal of optimizing the Func::call API as well as its C API
sibling of wasmtime_func_call. The strategy taken here is different
than #3298 though where a new API isn't created, rather a small tweak to
an existing API is done. Specifically this commit handles the major
sources of slowness with Func::call with:

Overall this change, in the benchmark of "call a nop function from the C
API" is not quite as good as #3298. It's still a bit slower, on the
order of 15ns, because there's lots of capacity checks around vectors
and the type checks are slightly less optimized than before. Overall
though this is still significantly better than today because allocations
and the rwlock to acquire the type information are both avoided. I
personally feel that this change is the best to do because it has less
of an API impact than #3298.

<!--

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 (Sep 08 2021 at 21:39):

alexcrichton updated PR #3319 from optimize-call-take-two to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 13 2021 at 18:12):

alexcrichton updated PR #3319 from optimize-call-take-two to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 14:53):

alexcrichton requested peterhuene for a review on PR #3319.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:42):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:42):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:42):

peterhuene created PR review comment:

Can we not use the wasm_val_storage here, instead of a new allocation, if we exposed the store data via the associated StoreRef?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:58):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:58):

alexcrichton created PR review comment:

We could yeah. The reason I didn't do it here is that this is part of the wasm.h C API which uses different store data. We could update that too but I figured I didn't want to worry much about this and thought I could deal with it later if necessary. Given the later *_unchecked APIs I ended up adding I think that no one's gonna use these for the most performance hooks anyway.

Do you agree it's alright to leave this for some future refactoring, if necessary?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:59):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 18:59):

peterhuene created PR review comment:

Definitely :+1:

view this post on Zulip Wasmtime GitHub notifications bot (Sep 21 2021 at 19:07):

alexcrichton merged PR #3319.


Last updated: Nov 22 2024 at 16:03 UTC