WebAssembly itself doesn't have any compression in its data segments, but Binaryen does split up data segments around ranges of zeroes as an optimization. That transformation depends on the memory being initialized to zero when it is created, making zeroes in data sections redundant.
On Sat, Jun 20, 2020 at 1:42 PM Floh <[email protected]> wrote: > I just noticed something interesting... through a stupid mistake on my > part I accidentally added 4 MBytes of bloat to my native-compiled > executables, because I statically initialized some innocent looking members > of a very big global struct variable (so that this global struct only had a > handful items initialized to non-zero values, but the remaining 4 MBytes > were all zeros). > > Interestingly, the (uncompressed) WASM version *wasn't* 4 MByte, instead > it was about the same size as if that massive global variable would be in > the BSS segment (that's why I didn't notice the bloat in the native > executables, I always check the size of the WASM output very carefully, but > not for the native builds). > > So my question: Does WASM have some sort of simple compression for the > data segment which kicks in for large chunks of zeroes? I tried to search > the available WASM info, but couldn't find anything "obvious"... > > Thanks! > -Floh. > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/756dcbba-a40f-4f78-af79-74aa46df7625o%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/756dcbba-a40f-4f78-af79-74aa46df7625o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EUjmu0sm0cyUTXG-FBt5bdXMVPUioru%2B3SMa_uY8zEK%2BQ%40mail.gmail.com.
