Check the size of metadata with wasm-GC modules
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox119 | --- | fixed |
People
(Reporter: rhunt, Assigned: jpages)
References
Details
Attachments
(3 files)
We have metadata for wasm modules which consume some memory overhead at runtime and size overhead when serializing the module.
With wasm-GC, modules are going to have many more stackmaps than before. We should make sure we're not blowing up our metadata size.
StackMaps are part of wasm::MetadataTier. They're an ordered list of bitmaps.
One thing we could do as part of this is to land some debug-only size tracking methods for modules. This would make it easier to track this over time.
We do have some 'sizeOf' methods already that are part of our about:memory reporting infrastructure [1]. It'd be nice to re-use those, but they work using a callback provided by our embedders which returns the size of memory blocks allocated using malloc.
| Assignee | ||
Comment 1•2 years ago
|
||
Here are some statistics about metadata sizes for a collection of wasm programs.
https://docs.google.com/spreadsheets/d/1Ykp-WGXF6dO7ITdpEQh_2TWiGnxFZ6uDUH9RsJiSGJ8/edit?usp=sharing
File size are as follow:
4.9M acrobat.wasm
832K amazon-ivs.wasm
52M autocad.wasm
5.0M bergamot.wasm
6.7M canvaskit.wasm
45M clang.wasm
2.4M dotnet.wasm,
21M earth.wasm
155K element.wasm
16M figma.wasm
366K google-meet-echo.wasm
11M google-meet-media.wasm
21K hyphenopoly-en-us.wasm
8.8M js.wasm
115K libopenjph_simd.wasm
80M photoshop.wasm
11M pspdfkit.wasm
9.1M pyodide.wasm
5.6M ruffle-1.wasm
5.7M ruffle-2.wasm
595K sql.wasm
13M stockfish-nnue.wasm
340K stockfish.wasm
374K tensorflow.wasm
990 ublock-biditrie.wasm
1.1K ublock-hntrie.wasm
1.2K ublock-lz4-block-codec.wasm
408 ublock-publicsuffixlist.wasm
1.7M zoom-audio.wasm
3.0M zoom-video.wasm
| Assignee | ||
Comment 2•2 years ago
|
||
In general, metadata size seems to be substantial. Metadata represent a 20 to 30% of generated code size for the baseline compiler.
Ion generates less code but the same amount of metadata, this proportion is even higher with 30 to 40% on average.
| Assignee | ||
Comment 3•2 years ago
|
||
Also add a function to get trap sites length in metadata.
| Assignee | ||
Comment 4•2 years ago
|
||
Use the --wasm-test-metadata to get an analysis of metadata size.
The wasmMetadataAnalysis() function returns a JS dictionary containing
various statistics related to metadata size.
Depends on D187944
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Comment 5•2 years ago
|
||
I've updated the statistics here https://docs.google.com/spreadsheets/d/1Ykp-WGXF6dO7ITdpEQh_2TWiGnxFZ6uDUH9RsJiSGJ8/edit?usp=sharing
I've also tried to run the analysis in debug and release, and got the same results (same sizes).
| Assignee | ||
Comment 6•2 years ago
|
||
Here is the script I'm using for collecting statistics in various wasm applications.
Comment 8•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/e27238af0e74
https://hg.mozilla.org/mozilla-central/rev/53f39978c827
Description
•