Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Cameron Simpson <cs@zip.com.au>
To: axp-list@redhat.com
Subject: Re: interesting observations...
Date: Mon, 11 Jan 1999 05:40:57 +0000	[thread overview]
Message-ID: <19990111164813-cameron-1-00149@byron.research.canon.com.au> (raw)
In-Reply-To: 19990111013358.26681.qmail@hotmail.com

On 11 Jan 1999, in message <19990111013358.26681.qmail@hotmail.com>
  "Designer 7" <designer_7@hotmail.com> wrote:
| I just recompiled egcs-1.1.1-release with a previous egcs-1.1.1-release 
| that I compiled with egcs-1.0.3b. Here is an interesting observation:
| 
| egcs-1.1.1 g++ compiled with egcs-1.1.1
| -rwxr-xr-x   1 root     root       118668 Jan 10 07:37 g++*
| 
| egcs-1.1.1 g++ compiled with egcs-1.0.3b
| -rwxr-xr-x   1 root     root       248948 Dec 14 01:34 g++*
| 
| Note the huge difference in size.. what's going on?
| 
| Both were compiled with the same flags except I changed -O2 to -O3 and 
| added -finline-functions during the second time around with egcs-1.1.1. 
| I would expect these flags to make the output larger... but now it's 
| less than half!

Hmm. What does the size(1) command say about those executbles?
(My first suspect is symbol tables, but parhaps the code really is
smaller...)

As regards size, heavier optionisation could readily produce smaller
code, and inlining functions strips all that function call stuff, which
could easily be a very big gain on small functions where trivial (or at
least fairly simple) operations have been abstracted into functions for
various reasons.

Consider the gains of inlining this:

	void incref(int *refp)
	{ *refp++;
	}

in code which makes lots of reference counter updates. The optimizer
could fold it down to a single instruction (or even optimise it out
completely for transient changes i.e. "incref(&p.cnt); blah blah blah
decref(&p.cnt)") whereas without inlining there's a whoel function call
setup, call, op-via-pointers, return. Potentially a large gain.

So, what's size(1) say about these images?
--
Cameron Simpson, DoD#743        cs@zip.com.au        http://www.zip.com.au/~cs/

Loose lids kink squids.	- Jody.P.Levine@hydro.on.ca DoD#275


      reply	other threads:[~1999-01-11  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-11  1:33 interesting observations Designer 7
1999-01-11  5:40 ` Cameron Simpson [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox