August 10
I try to build WebAssembly project, the wasm size is grow into 300kb even with "-Os -inline -release -noboundscheck".


there is a lot symbol like:

_foreachbody2MFPSQDfQDd10GameAssertZQBnMFPSQEfQEd10GameMethodZQCnMFPSQFfQFd12S2OptionZi


To build a c base game engine the size only like 90kb,  to build with D there is not so much login the size already be huge.


And the LLD is not inline  function for WASM like linux static binary format.

How can we cut down the size so we can make the LDC  generate WASM more deploy friendly.


Hidden un want symbol can cut down the size huge,  since WASM really don't want to expose internal symbol.   I think some option like https://github.com/ldc-developers/ldc/issues/2431  will be great.

Please share your opinion.




August 10
On Friday, 10 August 2018 at 06:41:51 UTC, learnfirst1 wrote:
> I try to build WebAssembly project, the wasm size is grow into 300kb even with "-Os -inline -release -noboundscheck".
>
>
> there is a lot symbol like:
>
> _foreachbody2MFPSQDfQDd10GameAssertZQBnMFPSQEfQEd10GameMethodZQCnMFPSQFfQFd12S2OptionZi
>
>
> To build a c base game engine the size only like 90kb,  to build with D there is not so much login the size already be huge.
>
>
> And the LLD is not inline  function for WASM like linux static binary format.
>
> How can we cut down the size so we can make the LDC  generate WASM more deploy friendly.
>
>
> Hidden un want symbol can cut down the size huge,  since WASM really don't want to expose internal symbol.   I think some option like https://github.com/ldc-developers/ldc/issues/2431  will be great.
>
> Please share your opinion.

Indeed there will be dead code left in the binary. This example shows that the foreach body gets inlined but the symbol emitted is still present.

https://godbolt.org/g/hwU8Zf

I think this will get solved by newer LLD (LLVM linker), I see that they added a `-gc-sections` option. https://github.com/llvm-mirror/lld/blob/master/wasm/Options.td#L70