kripken/emscripten — pull request #1334 by inolen (2013-06-27 20:28:05+00:00)
Title: Don't explicitly initialize 0-initialized globals

The idea here is to do something similar to the ELF / PE object formats and sort the 0-initialized globals to the end, enabling us to not have to explicitly store the initialization value for each byte. This significantly lowers the file output size when there are large amounts of uninitialized global data.

Also, even when `NAMED_GLOBALS` is enabled, it shortens the calls to allocate by passing in the size of data, as opposed to an array of 0's of size length.

As an example, with this change, the quake3 js went from 70mb -> 5mb, and the shared modules which depend on `NAMED_GLOBALS` dropped from 3.5mb -> 500k.

I ran the other and o2 tests, everything passes.

Also, since there was an indentation change, it may be helpful to look at the commit with whitespace differences ignored:
https://github.com/inolen/emscripten/commit/04c17e13fdf70e6670f80e168e30f7947ba453b7?w=1