* Executable size
@ 2023-01-21 3:47 Mike Rejsa
2023-01-21 13:16 ` NightStrike
0 siblings, 1 reply; 5+ messages in thread
From: Mike Rejsa @ 2023-01-21 3:47 UTC (permalink / raw)
To: gcc-help
Hi, new to gcc, running 32b on an old Win-XP notebook.
When I compile small utilities (say, treesort or equivalent, just console output) I get executables that are from 10-16 times larger as with my previous compiler (a 16b Aztec). Something that compiles to 7-8k with the Aztec is 100k+ with gcc. Why is this?
TIA
miker
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Executable size
2023-01-21 3:47 Executable size Mike Rejsa
@ 2023-01-21 13:16 ` NightStrike
0 siblings, 0 replies; 5+ messages in thread
From: NightStrike @ 2023-01-21 13:16 UTC (permalink / raw)
To: Mike Rejsa; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
On Fri, Jan 20, 2023, 22:47 Mike Rejsa via Gcc-help <gcc-help@gcc.gnu.org>
wrote:
> Hi, new to gcc, running 32b on an old Win-XP notebook.
>
> When I compile small utilities (say, treesort or equivalent, just console
> output) I get executables that are from 10-16 times larger as with my
> previous compiler (a 16b Aztec). Something that compiles to 7-8k with the
> Aztec is 100k+ with gcc. Why is this?
>
> TIA
> miker
>
Strip them afterwards. There's also -Os as an option.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Executable size
@ 2002-09-25 11:34 Douglas Richardson
0 siblings, 0 replies; 5+ messages in thread
From: Douglas Richardson @ 2002-09-25 11:34 UTC (permalink / raw)
To: 'Chris Croswhite'; +Cc: 'gcc-help@gcc.gnu.org'
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Executable size
@ 2002-09-25 10:57 Douglas Richardson
0 siblings, 0 replies; 5+ messages in thread
From: Douglas Richardson @ 2002-09-25 10:57 UTC (permalink / raw)
To: 'Chris Croswhite', gcc-help
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Executable size
@ 2002-09-25 10:55 Chris Croswhite
0 siblings, 0 replies; 5+ messages in thread
From: Chris Croswhite @ 2002-09-25 10:55 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-21 13:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 3:47 Executable size Mike Rejsa
2023-01-21 13:16 ` NightStrike
-- strict thread matches above, loose matches on Subject: below --
2002-09-25 11:34 Douglas Richardson
2002-09-25 10:57 Douglas Richardson
2002-09-25 10:55 Chris Croswhite
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).