Hi! Just a quick question: Is it fine to cache an InstancePre
over multiple invocations, potentially being invoked by different users?
Since this is pre passing in the store, I assume it just allows us to cache the compilation/linking step, but if there are any caveats or things to be aware of why I wouldn't want to do this, I'd appreciate it. Thanks!
Yes, that is it't intended use case.
Since this is pre passing in the store
According to the docs:
Note that an
InstancePre
may not be tied to any particularStore
if none of the imports it closed over are tied to any particularStore
.
Perfect thanks! If there is any code that happens at initialization, would this still happen then once it is actually turned into an Instance
? Again, I assume so, but don't want to be making any false assumptions. Thanks again for the quick response
InstancePre
doesn't run or cache the results of any wasm code; it mostly just early-binds imports and massages a few data structures, so that we don't have to do things like string-based import look ups at instantiation time
Perfect, thanks!
Last updated: Dec 23 2024 at 14:03 UTC