public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Douglas Richardson <douglas.richardson@gaussvip.com>
To: 'Chris Croswhite' <ccroswhite@get2chip.com>
Cc: "'gcc-help@gcc.gnu.org'" <gcc-help@gcc.gnu.org>
Subject: RE: Executable size
Date: Wed, 25 Sep 2002 11:34:00 -0000	[thread overview]
Message-ID: <AA067AE32DECD511B8A00002555878BC161F70@mailsrv2.magellan.com> (raw)

Chris,

I noticed the same thing. Based on some test programs I wrote I believe that
the C++ STL is to blame.

I wrote two hello world programs that I compiled with g++, one including
<iostream> and using cout, the other one including <stdio.h> and using
printf. Both were statically linked with the runtime libraries and stripped.
The program that used cout was about 194k while the one that used printf was
about 4k.

I also wrote a small test program that only included <vector> and it was
about 32k.

I know the STL library that ships with g++ has changed since 2.95, that that
is probably why you have seen the growth in your program size.

The only ways I can think of to reduce your code size is to either use gcc
2.95 or replace the code that relies on STL. I know that isn't a very
satisfying answer, but it's all I got.

Douglas Richardson.

-----Original Message-----
From: Chris Croswhite [mailto:ccroswhite@get2chip.com]
Sent: Wednesday, September 25, 2002 11:06
To: Douglas Richardson
Subject: RE: Executable size


I am currently using 3.2, but I have watched from 2.95 to 3.03, 3.1 and
then 3.2 that the executable is growing by at least 30%.  I have tried
this across all optimizations - O,O2,O3,g.  In the case of -g, the
executable is 55% larger, in the case of O3 it is 31% larger (than using
2.953).


Here:

2.953:
-g = 30560264
-O = 8889831
-O2 = 8893383
-O3 = 9009271

3.2:
-g = 63274234
-O = 11198086
-O2 = 11458534
-O3 = 11252525

The code base is mixed c/c++ but I use g++ to compile everything.  I am
making a statically linked executable.

TIA,
Chris


On Wed, 2002-09-25 at 10:57, Douglas Richardson wrote:
> Chris,
> 
> Are you using any optimizations? How are you linking with the runtime
> libraries?
> 
> Send the output of gcc -v.
> 
> Douglas Richardson.
> 
> -----Original Message-----
> From: Chris Croswhite [mailto:ccroswhite@get2chip.com]
> Sent: Wednesday, September 25, 2002 10:55
> To: gcc-help@gcc.gnu.org
> Subject: Executable size
> 
> 
> Sirs,
> 
> I am trying to figure out how to reduce the size of my executable (that
> has grown with the increments of gcc upgrades even though the code base
> has not changed).  I would like to understand how I can reduce/cut out
> so that the executable to back down to the 2.953 size.  Can anyone give
> me some pointers?
> 
> TIA,
> Chris
> 

             reply	other threads:[~2002-09-25 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25 11:34 Douglas Richardson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-21  3:47 Mike Rejsa
2023-01-21 13:16 ` NightStrike
2002-09-25 10:57 Douglas Richardson
2002-09-25 10:55 Chris Croswhite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AA067AE32DECD511B8A00002555878BC161F70@mailsrv2.magellan.com \
    --to=douglas.richardson@gaussvip.com \
    --cc=ccroswhite@get2chip.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).