My resulting asmjs outputs are massive and it's making me sad! I've tracked 
most of the size down to ios_base's global initializer (and the world that 
it pulls in) -- even though I'm not using iostream (or really much of 
anything) and was wondering if anyone had a way to get around this.

My hello world sample compiles to 6KiB, but if I include <string> and add a 
single `std::string foo;` it jumps up ~100KiB (even in -O2 with --llvm-lto 
1).
The big difference in output comes down to this:
```
function __GLOBAL__I_000101() {
 var label = 0, sp = 0;
 sp = STACKTOP;
 __ZNSt3__18ios_base4InitC2Ev(0);
 return;
}
+ a billion functions called by ios_base::Init.
```

That ios_base::Init pulls in locale and a bunch of other stuff that is only 
ever called from that stack. Because it's a global initializer dead-code 
removal won't get rid of it and it ends up in my final output. It seems a 
bit silly that even when not using iostream (cin/cout/strstream/etc) I 
still take a massive hit.

I found this issue from a year or so ago which seems like exactly what I'm 
seeing:
https://github.com/kripken/emscripten/issues/2545

Unfortunately the fix proposed never made it 
in: https://github.com/kripken/emscripten/pull/3308

Besides not using std::string anywhere (which is extremely difficult given 
the code I'm compiling) has anyone found solutions for removing this bloat? 
Is there any emscripten features (in-progress or planned) that will help 
situations like this?

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to