This is the mail archive of the gcc@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: cutting the size of CONST_DECLs


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. 

        


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