emscripten-core / emscripten-core/emscripten

Do not generate JS Export Stubs

Open
#10,099 12 comments 1 reaction 1 assignee Claimed by @sbc100 View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

After merging https://github.com/emscripten-core/emscripten/pull/9917, side modules should access exported functions from the main module thru the Module["asm"] property to speed up execution. However, the export JS stubs are still generated e.g.

```javascript
var ___mainy = Module["___mainy "] = function() {
return Module["asm"]["___mainy "].apply(null, arguments);
};
```

Removing these stubs (except the initalizers) can reduce the size of my JS file by around 50% as I have a large number of exports so I would definitely like to give it a try. However, I see that after removing these stubs, the exported wasm functions are also removed from the wasm module by wasm-metadce.

@kripken and @sbc100, is there a way to keep these exported functions in the wasm module after running wasm-metadce irrespective of whether the corresponding JS stubs exist? Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.