Skip to content

WASM shared modules export unnecessary symbols even with -s MAIN_MODULE 2  #5586

Closed
@Auron52

Description

@Auron52

See the discussion at https://groups.google.com/forum/#!topic/emscripten-discuss/zZsG7spmdug for background.

The basic issue is that WASM builds with -s MAIN_MODULE 2 can be unnecessarily large due to extra symbols being exported.

The sample at https://drive.google.com/open?id=0B462aSLeSsPMUFhnNW1iYzhjeHM can be used to reproduce the problem. The zip also includes the output
Build with default MAIN_MODULE=0: 66 KB .js file and 38 KB .wasm file
Build with -s MAIN_MODULE 2: 173 KB .js file and 48 KB .wasm file

Alon Zakai's Comment: "Looking at this, the main module 2 is 23% larger. Looks like much of that is due to us exporting all the functions in the table (which limits dce). I think we don't need that for wasm shared modules, this is just something that wasn't optimized yet."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions