This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: cutting the size of CONST_DECLs
- From: Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>
- To: Robert Bowdidge <bowdidge at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 27 Feb 2004 16:20:39 -0800
- Subject: Re: cutting the size of CONST_DECLs
- References: <2B448A8E-6977-11D8-B63F-000A957D89DA@apple.com>
Robert Bowdidge <bowdidge@apple.com> writes:
> Hi, all,
>
> At Apple, the compiler's memory use (and its effect on compile speed)
> is our biggest concern. One specific worry is declarations. On
> common Mac programs which include headers for our GUI libraries,
> declarations fill a significant amount of garbage-collected memory.
> With -fmem-report, we usually see about 35% of memory filled with
> declarations.
> CONST_DECLs are an obvious offender in our programs; many of the Mac
> headers make heavy use of enums to define symbolic constants. In
> some programs, CONST_DECLS are the third most common kind of
> declaration after FUNCTION_DECL and PARM_DECL, and can be responsible
> for 30% of declarations and 10% of gc'd memory.
>
> I've tried one change to cut memory use: creating a new, smaller
> structure for CONST_DECLs only, and having all other declarations
> inherit this structure and extend it with the rest of the fields. On
> a couple typical applications, this change cuts memory use by 4-6% and
> compilation time by 0-3%.
You might also want to look at doing something about FUNCTION_DECLs. There are
a few fields in struct tree_decl that are only used for
FUNCTION_DECLs: inlined_fns, saved_tree. If you somehow reorganize
struct tree_decl and manage to leave these fields out for everything
but FUNCTION_DECLs you will get some memory savings.
Also "vindex" is only used for languages that use inheritance, so it
is useless for C. Moving "vindex" to "lang_specific" might be
interesting too.