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] Share all integer constants


Hello,

> >this patch makes all integer constants to be shared, instead of just the
> >small ones.  This brings relatively significant memory savings (on the
> >constant themselves, as well as on vectors kept at each type).
> > 
> >
> This is not OK.  At least, not until you analyze why this makes GCC 
> itself go slower.

the reason seems to be simply the overhead of caching (the original
overhead was about 1%, I reduced it to 0.5% by making the functions
to enter the constants into the hash table more efficient).  I
will try to think about how to reduce this further.

> Note that there are some places in the C++ front end where we are 
> probably still creating integer constants for array indices that are 
> wasted.  You might want to try to fix those, rather than using this big 
> heavy hammer.

Well, I do not consider it that big hammer; it is a fairly simple change
now that most of the work was done by previous patches, and it seems to
me to be a bit cleaner to share all constants rather than only some.

Of course not creating that many constants is a good idea anyway (and it
would very likely reduce the compile time overhead of this patch).

Zdenek


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