This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ optimization: compile time + memory consumption regressionon gcc3.3 branch
- From: Michael Matz <matz at suse dot de>
- To: Karel Gardas <kgardas at objectsecurity dot com>
- Cc: Mike Stump <mstump at apple dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Fri, 28 Feb 2003 22:40:04 +0100 (CET)
- Subject: Re: C++ optimization: compile time + memory consumption regressionon gcc3.3 branch
Hi,
On Fri, 28 Feb 2003, Karel Gardas wrote:
> > If not, just include the .ii in the bug report, and hope and pray
> > someone else will do the work.
>
> Pray will certainly help, but I'll try to get some numbers for you.
> Anyway, I hope someone already described how to compile gcc with profiling
> information so I'll be able to find it in the archive...
When I want to do something like this I do the following:
- create a preprocessed version of the source in question, note the
option with which it exhibits the behaviour.
- checkout GCC of the interesting version somewhere (/src/gcc)
% cd /src/
% mkdir devel inst; cd devel
% CFLAGS="-g -pg" ../gcc/configure --prefix=/src/inst \
--enable-languages=c,c++
% make -j 8
(note: _not_ bootstrapping; often I also forget the setting of CFLAGS
before configure. In that case I usually just edit the top-level Makefile
(search for "O2"))
Now there is a profilable /src/devel/gcc/cc1plus (and cc1), ergo:
% cd /src; cp <sourcecode>.ii .
% ./devel/gcc/cc1plus [all-the-options] <sourcecode>.ii
% gprof ./devel/gcc/cc1plus
Before and after means simply once with a checkout of the fast version,
and once with the slow one. So you can identify the bottleneck. In your
case expand needs excessively long, so I guess simply looking at the
profile of that one is enough to see the bottleneck.
Ciao,
Michael.