This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory


On Tue, 20 Feb 2007, Michael Matz wrote:

> Hi,
> 
> On Wed, 13 Dec 2006, Mark Mitchell wrote:
> 
> > Nobody is arguing that DW_AT_name should be the huge string for the long 
> > term.  However, I would argue that it should stay that huge string until 
> > we add the template arguments to debug info, and until GDB understands 
> > that information.
> 
> Okay, so the attached patch does that.  On the testcase from PR29433 it 
> has these results (on x86_64, but with -m32):
> 
> trunk,   -O0,    total: 1403994 kB  (3:00 min)
> patched, -O0,    total:  353658 kB  (1:11 min)
> trunk,   -O0 -g, total: 2539302 kB  (3:17 min)
> patched, -O0 -g, total: 1668378 kB  (2:32 min)
> 
> So it saves between 900MB and 1.1 GB :)  [It also saves memory with -g 
> because the strings are ggc_stddup'd again]  I've removed the hand-crafted 
> mangle_class_name_for_template and classtype_mangled_name functions and 
> instead used the diagnostics machinery for real by not simply looking at 
> DECL_NAME of a type (in dwarf2out), but instead use the dwarf_name 
> langhook there.  In C that will be equivalent to using DECL_NAME in C++ it 
> will call cxx_printable_name, which prints nice (long) names for 
> complicated types.  The verbosity needs to be 2 for that, and instead of 
> adding yet another langhook or wrapper function which is called just once, 
> I've called it directly.

I noticed dwarf_name is mapped to decl_printable_name for C++ and
we can gain another xstrdup/free if we implement the dwarf_name
langhook for C++ by simply using cp/error.c:lang_decl_name.  This way
we avoid using the cxx_printable_name ring buffer for function decls.

This might shave off a few seconds in compile time and a few bytes
off peak memory usage.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]