As of Firefox 155, we intend to enable the WebAssembly compact import section encoding by default on all platforms. This is a binary-only change to reduce module sizes with no impact to WebAssembly semantics.
Summary:
The import section of a WebAssembly binary currently is a simple list of (module name, item name, type) tuples. In practice, the module names are highly redundant (usually all "env" or similar), and for modules with many imports, this can be surprisingly wasteful.
The impact is particularly large for users of imported JS string constants. In this case, the expected overhead is so high that MDN recommends using an empty string as the module name to minimize binary size, which is absurd and points to the need for a less wasteful encoding.
The Compact Import Section proposal, which we champion, addresses this problem by providing two new binary encoding options that deduplicate module names, and optionally the import types as well. This is an encoding-only change with no impact to the behavior or semantics of WebAssembly.
Bugs:
Tracker: https://bugzilla.mozilla.org/show_bug.cgi?id=wasm-compact-imports
Enable by default: https://bugzilla.mozilla.org/show_bug.cgi?id=2062344
Specification:
https://github.com/WebAssembly/compact-import-section
Standards Body:
W3C (WebAssembly CG & WG)
Platform Coverage:
All platforms
Preference:
javascript.options.wasm_compact_imports
DevTools Bug:
N/A
Extensions Bug:
N/A
Use Counter:
N/A
Standards-Position Discussion:
None, covered by our blanket policy for Wasm proposals.
Other Browsers:
- Blink: Implemented, not yet shipped (https://chromium-review.googlesource.com/c/v8/v8/+/7573949)
- WebKit: No public signals
web-platform-tests:
None yet, but we run the official spec tests that will eventually be upstreamed into WPT.