Code size

April 26, 2009

How do the relative modules contribute to the total code size?

# Total .so sizes.
$ find out -name '*.so' | xargs ls -l | awk '{s+=$5}END{print s}'
373444585

# Pretty-print sorted sizes.
$ find out -name '*.so' | xargs ls -l | \
  awk '{printf("%10d %4.1f%% %s\n",$5,$5*100/373444585,$8)}' | \
  sort -n
     28088  0.0% out/third_party/modp_b64/libmodp_b64.so
     72216  0.0% out/printing/libprinting.so
     97200  0.0% out/third_party/harfbuzz/libharfbuzz_interface.so
    115664  0.0% out/third_party/bzip2/libbzip2.so
    190384  0.1% out/webkit/libpcre.so
    203548  0.1% out/third_party/zlib/libzlib.so
    263692  0.1% out/third_party/libpng/liblibpng.so
    306696  0.1% out/third_party/libevent/liblibevent.so
    375136  0.1% out/webkit/libwtf.so
    459348  0.1% out/base/libbase_gfx.so
    512372  0.1% out/third_party/libjpeg/liblibjpeg.so
    515716  0.1% out/build/temp_gyp/libv8_nosnapshot.so
    523624  0.1% out/third_party/harfbuzz/libharfbuzz.so
    580724  0.2% out/sdch/libsdch.so
    698880  0.2% out/third_party/libxslt/liblibxslt.so
    713124  0.2% out/webkit/libwebkit.so
    728508  0.2% out/build/temp_gyp/libv8.so
    825216  0.2% out/build/temp_gyp/libgoogleurl.so
    888800  0.2% out/chrome/third_party/hunspell/libhunspell.so
   1017504  0.3% out/testing/libgtest.so
   1042164  0.3% out/media/libmedia.so
   1917352  0.5% out/third_party/sqlite/libsqlite.so
   2028324  0.5% out/chrome/libplugin.so
   2095888  0.6% out/chrome/libviews.so
   3414156  0.9% out/third_party/libxml/liblibxml.so
   3440500  0.9% out/third_party/icu38/libicuuc.so
   4284240  1.1% out/skia/libskia.so
   4488020  1.2% out/third_party/icu38/libicui18n.so
   6410096  1.7% out/base/libbase.so
   6443348  1.7% out/chrome/librenderer.so
   8417233  2.3% out/third_party/icu38/libicudata.so
   8623576  2.3% out/chrome/libcommon.so
  10373600  2.8% out/net/libnet.so
  17959968  4.8% out/webkit/libglue.so
  19797692  5.3% out/build/temp_gyp/libv8_base.so
  52238608 14.0% out/chrome/libbrowser.so
 211353380 56.6% out/webkit/libwebcore.so

Some non-obvious big ones: libglue is our C++ binding to WebKit. libicudata is 8mb of ICU tables stuffed into the binary. libviews is a GUI toolkit for Windows that manages window layout, drawing via Skia, etc.

Methodology: These were built with -O2 but still still contain symbols.

Please take with a grain of salt. WebCore makes heavy use of templates which produce very long symbol names. To pick a random example, ZZNK3WTF22HashTableConstIteratorIN7WebCore6StringES2_NS_ 17IdentityExtractorIS2_EENS1_10StringHashENS_10HashTraitsIS2_ EES7_E13checkValidityEvE19__PRETTY_FUNCTION__ shows up from objdump -t. (That's `WTF::HashTableConstIterator, WebCore::StringHash, WTF::HashTraits, WTF::HashTraits

::checkValidity() const::PRETTY_FUNCTION` after demangling.)