alexcrichton opened PR #3883 from call-benchmark
to main
:
The goal of this new benchmark,
call
, is to help us measure the
overhead of both calling into WebAssembly from the host as well as
calling the host from WebAssembly. There's lots of various ways to
measure this so this benchmark is a bit large but should hopefully be
pretty thorough. It's expected that this benchmark will rarely be run in
its entirety but rather only a subset of the benchmarks will be run at
any one given time.Some metrics measured here are:
Typed vs Untyped vs Unchecked - testing the cost of both calling wasm
with these various methods as well as having wasm call the host where
the host function is defined with these various methods.With and without
call_hook
- helps to measure the overhead of the
Store::call_hook
API.Synchronous and Asynchronous - measures the overhead of calling into
WebAssembly asynchronously (with and without the pooling allocator) in
addition to defining host APIs in various methods when wasm is called
asynchronously.Currently all the numbers are as expected, notably:
- Host calling WebAssembly is ~25ns of overhead
- WebAssembly calling the host is ~3ns of overhead
"Unchecked" is a bit slower than "typed", and "Untyped" is slower than
unchecked.Asynchronous wasm calling a synchronous host function has ~3ns of
overhead (nothing more than usual).Asynchronous calls are much slower, on the order of 2-3us due to
madvise
.Lots of other fiddly bits that can be measured here, but this will
hopefully help establish a benchmark through which we can measure in the
future in addition to measuring changes such as #3876<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
pchickey submitted PR review.
alexcrichton merged PR #3883.
Last updated: Nov 22 2024 at 17:03 UTC