This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Using std::string leads to large size of executable
>> I have yet to run across smaller binaries than g++ 3.x and libstdc++ on
>> linux.
>
>I don't mean to rain on your parade but I recently did a comparison
>of the sizes of binaries on Linux and found some pretty disturbing
>results (when compared to stdio) with all recent C++ libraries. You
>may find the numbers interesting. A "Hello, World!" program compiled
>on i86 Linux with gcc -Os and statically linked with the dependent
>libraries takes up this much space:
>
> gcc 2.95.2/glibc stdio 888 KB (printf)
> gcc 2.95.2/libstdc++ iostreams 1,375 KB (classic iostreams)
> gcc 3.2.1/libstc++ iostreams 4,092 KB (standard iostreams)
> gcc 2.95.2/libstd 3.1 iostreams 1,914 KB (standard iostreams)
> gcc 3.2.1/libstd 3.1 iostreams 1,945 KB (standard iostreams)
> gcc 2.95.2/stlport 4.5 iostreams 2,281 KB (standard iostreams)
Oh, I meant to say shared, and stripped. If you look you'll see minimal
or no growth. Static size is another issue, and is not a focus for me.
There has been a change in debug formats, and emitted debug info between
2.9x and 3.2.x. Some of the resulting size growth was fixed with Scott
Snyder's patch to remove unused debug info, but duplicates are still not
being removed.
-benjamin