Skip to content

feat(worker-build): support split WebAssembly debug info - #1066

Open
logan-gatlin wants to merge 5 commits into
flagship-per-mono-genericsfrom
t3code/debug-wasm-source-maps
Open

logan-gatlin wants to merge 5 commits into
flagship-per-mono-genericsfrom
t3code/debug-wasm-source-maps

Conversation

@logan-gatlin

@logan-gatlin logan-gatlin commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add split-debug-info profile support to worker-build and enable it in workers-rs templates.
  • Preserve DWARF through compilation and wasm-opt, then emit standards-compliant *.debug.wasm external DWARF sidecars.
  • Strip runtime .debug_* sections and add one relative external_debug_info reference encoded as a WebAssembly name.
  • Keep sidecars through staged and legacy output moves while removing stale sidecars when splitting is disabled.
  • Update vendored wasm-bindgen to Walrus 0.27.2, fixing malformed DWARF that caused Binaryen 130 to abort.
  • Document the filesystem contract and remaining Wrangler, upload API, workerd, and observability integration work.

Testing

  • cargo test -p worker-build (21 tests)
  • cargo clippy -p worker-build --all-targets -- -D warnings
  • cargo fmt -p worker-build -- --check
  • Rust 1.93 Axum template build through Binaryen 130, run twice with identical runtime and sidecar SHA-256 values
  • wasm-tools validate on both the runtime and external DWARF sidecar
  • Section inspection confirms one runtime external_debug_info, no runtime .debug_*, and DWARF sections in the sidecar

- Preserve DWARF through the build pipeline and emit `.debug.wasm` sidecars
- Strip runtime debug sections and reference sidecars via `external_debug_info`
- Add manifest configuration, template defaults, cleanup, and coverage
@codspeed

codspeed Bot commented Sep 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 2 untouched benchmarks


Comparing t3code/debug-wasm-source-maps (5b37e5f) with main (78dc0cd)1

Open in CodSpeed

Footnotes

  1. No successful run was found on flagship-per-mono-generics (8be4ab2) during the generation of this report, so main (78dc0cd) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@logan-gatlin

Copy link
Copy Markdown
Collaborator Author

Currently this will do nothing. Needs a workerd follow up to accept wasm debug sidecar files in addition to JS sourcemaps

Advance the wasm-bindgen submodule to the Walrus 0.27.2 fix and remove the rolled-back memory.discard experiment so Binaryen 130 can optimize DWARF-enabled template builds.
Validate runtime and sidecar Wasm, make repeated splitting deterministic, canonicalize external_debug_info references, improve tool and file errors, and document the Wrangler/platform integration contract.
@guybedford

Copy link
Copy Markdown
Collaborator

What is the benefit of splitting the debug information for Workers, over publishing a binary with the debug section included?

@logan-gatlin

Copy link
Copy Markdown
Collaborator Author

What is the benefit of splitting the debug information for Workers, over publishing a binary with the debug section included?

Javascript source maps do not count towards the bundle size limit, and do not impact cold start time. The idea is to put wasm debug info in this separate bucket so it gets the same benefits as js

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.

2 participants