Skip to content

perf(transpile): share export adapters and deduplicate core modules - #2597

Merged
vados-cosmonic merged 30 commits into
bytecodealliance:mainfrom
vados-cosmonic:perf/runtime-dedupe-call-entry
Dec 2, 2026
Merged

vados-cosmonic merged 30 commits into
bytecodealliance:mainfrom
vados-cosmonic:perf/runtime-dedupe-call-entry

Conversation

@vados-cosmonic

@vados-cosmonic vados-cosmonic commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

These changes reduce the JavaScript generated for component calls and the Wasm emitted for repeated core modules. The shared-runtime work was inspired by wcjs. This PR includes the five commits from #2598.

  • The CLI and JavaScript transpiler enable the synchronous fast path by default for eligible components. Use --no-perf-sync-fast-path or perfSyncFastPath: false to create a task for every call. The performance guide documents the observable difference when a guest catches a host throwing null or undefined.
  • Byte-identical core modules share one emitted binary and one compilation. Each instantiation still creates its own Wasm instance and mutable state.
  • For synchronous exports that need a task, bindings can delegate setup, invocation and cleanup to createSyncExportRunner. Async exports use a static descriptor with startExportTask. Lift/lower metadata is memoized per component instance.
  • --cm-runtime-target current|compatible selects the provider operations used by generated bindings. Custom providers can use the baseline API-v1 contract. The installed-package tests exercise both provider contracts and the benchmark measures the cost of adding exports.
  • Transpilation reports the boundary that requires JSPI through jspiRequirement. Generated bindings check for the required APIs, and the CLI warns when the component needs JSPI and it was not requested.
  • The debug profile traces guarded built-in calls. The tests type-check fixture declarations in strict mode, enforce gzip budgets, and check that a synchronous component leaves out the async scheduler. CI checks the embedded runtime against its source, with a release-PR exception. Generating inline Rust intrinsics is deprecated.

@vados-cosmonic vados-cosmonic changed the title perf: lean on the runtime for export calls and shared metadata perf(transpile): share export adapters and deduplicate core modules Dec 2, 2026
feat(runtime): share synchronous export task lifecycles
feat(bindgen): target shared adapters and infer JSPI requirements
perf(bindgen): preserve checked fast paths for pinned runtimes
test(runtime): exercise installed adapters and measure export growth
test(transpile): map the sync export runner in the browser harness
A composition can embed the same core module more than once. Each copy after the
first now reuses the first copy's compiled module instead of being emitted as a
separate file and compiled again.
perfSyncFastPath is now on unless it is set to false. Calls of synchronous functions
on eligible components skip creating a task.
`jco transpile` now uses the sync fast path unless `--no-perf-sync-fast-path` is given,
whatever the default of the jco-transpile release it uses.
Apply the runtime and benchmark style checks to the shared adapter changes.
@vados-cosmonic
vados-cosmonic force-pushed the perf/runtime-dedupe-call-entry branch from ef28c7a to 54b3284 Compare December 2, 2026 11:47
@vados-cosmonic
vados-cosmonic marked this pull request as ready for review December 2, 2026 14:08
@vados-cosmonic
vados-cosmonic added this pull request to the merge queue Dec 2, 2026
Merged via the queue into bytecodealliance:main with commit 1f547c7 Dec 2, 2026
146 of 148 checks passed
@vados-cosmonic
vados-cosmonic deleted the perf/runtime-dedupe-call-entry branch December 2, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant