Stream: git-wasmtime

Topic: wasmtime / PR #2946 expose eager thread-local resource in...


view this post on Zulip Wasmtime GitHub notifications bot (May 27 2021 at 23:03):

pchickey opened PR #2946 from pch/eager_per_thread_init to main:

Based on #2897 - draft until that lands

In the Tokio runtime and elsewhere, it is useful to eagerly initialize thread-local resources (signal handlers etc) to avoid taking a runtime hit after a service is started.

<!--

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 (May 27 2021 at 23:03):

pchickey requested alexcrichton for a review on PR #2946.

view this post on Zulip Wasmtime GitHub notifications bot (May 28 2021 at 15:05):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2021 at 22:09):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2021 at 22:15):

pchickey has marked PR #2946 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 14:16):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 14:16):

alexcrichton created PR review comment:

This could probably be a bit simpler with if initialized { return } and then p.set((state, true)) afterwards

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 18:22):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 18:35):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 19:25):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 19:44):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 19:44):

alexcrichton created PR review comment:

As a suggestion for a doc block here:

Eagerly initialize thread-local functionality shared by all [Engine]s.

Wasmtime's implementation on some platforms may involve per-thread setup that needs to happen whenever WebAssembly is invoked. This setup can take on the order of a few hundred microseconds, whereas the overhead of calling WebAssembly is otherwise on the order of a few nanoseconds. This setup cost is paid once per-OS-thread. If your application is sensitive to the latencies of WebAssembly function calls, even those that happen first on a thread, then this function can be used to improve the consistency of each call into WebAssembly by explicitly frontloading the cost of the one-time setup per-thread.

Note that this function is not required to be called in any embedding. Wasmtime will automatically initialize thread-local-state as necessary on calls into WebAssembly. This is provided for use cases where the latency of WebAssembly calls are extra-important, which is not necessarily true of all embeddings.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 21:04):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 21:04):

pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 21:04):

pchickey created PR review comment:

Thanks! That doc, and the bench docs, are now pushed.

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

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 21:22):

pchickey updated PR #2946 from pch/eager_per_thread_init to main.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2021 at 22:42):

pchickey merged PR #2946.


Last updated: Oct 23 2024 at 20:03 UTC