Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2004 18:00:31 -1000
From:      Clifton Royston <cliftonr@lava.net>
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        hackers@FreeBSD.org
Subject:   Re: Adventures with gcc: code vs object-code size
Message-ID:  <20040322040030.GA24373@lava.net>
In-Reply-To: <p06020452bc83c757f354@[128.113.24.47]>
References:  <20040321200044.C571716A4D0@hub.freebsd.org> <20040321202243.GA3199@lava.net> <p06020452bc83c757f354@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 21, 2004 at 05:39:58PM -0500, Garance A Drosihn wrote:
> At 10:22 AM -1000 3/21/04, Clifton Royston wrote:
> > > Date: Sat, 20 Mar 2004   From: Garance A Drosihn
> > >
> > > So, by adding one call to strcmp() to check for a ":" string, I
> > > end up with /bin/ps (the stripped-object-file) which has grown
> > > by  12.6% !!  This is for a program which is almost 2500 lines
> > > spread out over 5 '.c'-files.  How is that possible?  What am
> > > I missing here?
> >
> >  If it happens that strcmp was not previously being referenced
> >at all, absent this one line, then of course this change will
> >pull in the strcmp routine.  Now while strcmp itself is not ...
> 
> I forgot to include a significant part of this puzzle.  The same
> ps.c file already had two calls to strcmp() in it:
> 
> ps.c:   if (strcmp(elem, "co") == 0)
> ps.c:                   if (strcmp(elemcopy, ":") == 0)
> ps.c:           if (strcmp(vent->var->name, v->name) == 0)
> 
> There was no strcmp() in the subroutine that I added it to, but
> I would assume that those other references would have already
> pulled in the routine.

  Ah, totally different story then.  OK, I'm baffled too.
 
> >  This may also be true even if gcc is partially inlining it.
> >gcc may be pulling in a big clump of its own internal support
> >routines in that case, ...
> 
> but would it inline it's own routines multiple times in the same
> source file?

  No, it definitely shouldn't.

  -- Clifton

-- 
          Clifton Royston  --  cliftonr@tikitechnologies.com 
         Tiki Technologies Lead Programmer/Software Architect
Did you ever fly a kite in bed?  Did you ever walk with ten cats on your head?
  Did you ever milk this kind of cow?  Well we can do it.  We know how.
If you never did, you should.  These things are fun, and fun is good.
                                                                 -- Dr. Seuss



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040322040030.GA24373>