This is the mail archive of the 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


> >>>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.
> Would it not be better to keep using the vectors for small ints, and
> fall back on the cache for larger ones?

the amount of memory spent by the vectors is not completely negligible
(about 1% of memory spent on trees for combine.i, and very likely more
for smaller programs).  But I will give it try, perhaps it will help.

> That would keep the fast
> lookup for small ints.  This would be a much smaller patch, local
> to build_int_cst_wide.
> Is the extra work for caching the overflowed ones worth it?  I never
> found much occurence of them in real programs.

I think that they are not really significant, I just liked more handling
things consistently.  Sharing just nonoverflowed constant is of course
much easier (I had a patch for this, but I "improved" it to the current
version in process of trying to fix a bug that showed up to be unrelated
to it).  It might be that sharing only normal constants would also be
more efficient, I will give it a try.


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