egcs produces bloated code by default
I know people have mentioned exception-handling overhead before, but I just
did some experiments with the newest Debian g++ package (2.91.57-5) and was
really distressed with the results.
I compiled my wvdial package. This is a prerelease of wvdial 1.20, but the
results should hold for most any C++ program. If not, then at least any
version of wvdial.
First, the raw data. Here's the difference that optimization settings can
make. Yes, all the binaries are stripped.
-rwxrwxr-x 1 apenwarr apenwarr 102548 Oct 25 17:06 wvdial.mopt*
-rwxrwxr-x 1 apenwarr apenwarr 66756 Oct 25 17:10 wvdial.neopt*
-rwxrwxr-x 1 apenwarr apenwarr 109396 Oct 25 17:02 wvdial.noopt*
-rwxrwxr-x 1 apenwarr apenwarr 63036 Oct 25 17:00 wvdial.opt*
-rwxrwxr-x 1 apenwarr apenwarr 62332 Oct 25 17:06 wvdialconf.mopt*
-rwxrwxr-x 1 apenwarr apenwarr 44112 Oct 25 17:10 wvdialconf.neopt*
-rwxrwxr-x 1 apenwarr apenwarr 68528 Oct 25 17:03 wvdialconf.noopt*
-rwxrwxr-x 1 apenwarr apenwarr 37396 Oct 25 17:00 wvdialconf.opt*
The optimizations used for each run:
.mopt - medium optimization
-O6 -fomit-frame-pointer -fno-implement-inlines
.neopt - no-exception optimization
.noopt - no optimization
.opt - full optimization
-O6 -fomit-frame-pointer -fno-implement-inlines \
There's a tremendous size difference between optimized and unoptimized
versions (opt->noopt is 63k->109k). This doesn't bother me much, since
non-optimized code isn't supposed to be all that small or fast. Fine.
But the .mopt version of wvdial is 102k. That only trimmed 7k from the
Much more interesting is the incremental improvement from non-optimized to
non-optimized without exception information: noopt->neopt is 109k->66k.
I've saved 42.6k! That's almost 40% space overhead for exceptions! _All_
the other optimizations together only saved me another 3k.
Is this really acceptable? When the 2.2 kernel is released, Debian will
probably switch to using egcs for the C compiler, as well as C++. That
means, unless I miss my guess, that almost all of Debian will increase in
size by 40% unless we add these compile options. I don't think that should
Is there nothing we can do? Have I missed something obvious? (Because if I
have, my wvdial-1.10.deb package is about 40% larger than it needs to be.)