Commit e716825
committed
runtime: Cache InstancePre on ValidModule for faster trigger instantiation
Extract linker construction from per-trigger `from_valid_module_with_ctx`
into a standalone `build_linker()` function called once at module
validation time. The linker is pre-linked via `linker.instantiate_pre()`
and the resulting `InstancePre` is stored on `ValidModule`.
This eliminates the per-trigger cost of:
- Rebuilding a Linker with ~60 func_wrap_async registrations
- Resolving imports against the module
Chain-specific host functions (e.g. ethereum.call) are now dispatched
generically: the linker registers them by import name and looks up the
actual HostFn from caller.data().ctx.host_fns at call time.
Conditional functions (ipfs.getBlock, arweave.transactionData,
box.profile) are now linked unconditionally since they already check
feature flags or return errors internally.1 parent fccebe8 commit e716825
2 files changed
+405
-316
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
225 | 230 | | |
226 | 231 | | |
227 | 232 | | |
| |||
340 | 345 | | |
341 | 346 | | |
342 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
343 | 351 | | |
344 | 352 | | |
| 353 | + | |
345 | 354 | | |
346 | 355 | | |
347 | 356 | | |
| |||
0 commit comments