Patch: speed up compiler a little bit by optimizing lookup_attribute() and is_attribute_p()

Richard Guenther
Tue Jun 21 11:11:00 GMT 2011

On Tue, Jun 21, 2011 at 12:17 PM, Nicola Pero
<> wrote:
>>> This patch speeds up the C/C++/ObjC/ObjC++ compiler a little bit by optimizing
>>> lookup_attribute() and is_attribute_p().  The main change is that these functions
>>> are now inline.
>> I don't think this is a good idea.
> Can you explain why ?  You never do in your response :-)
> I'm guessing it's because you think the inline functions are too big and that's
> counter-productive ?


>> For this case I'd factor out the NULL attribute list check into an
>> inline function and keeping the non-NULL attribute list pieces out-of-line.
> Ok ... so is this what you'd like - the common, hot case in the inline function,
> and the less common, cold case in the out-of-line one ? :-)


> That makes sense - I'll try that out tonight (it takes a few hours to run all
> the benchmarks). ;-)


>> Does it work for all languages?  And yes, I agree it would be nice to
>> canonicalize to the form without _s even in the attribute lists itself.
>> Or go one step further - do not store an identifier but an enum as we
>> in fact only ever insert known attributes into the list (which should
>> be a VEC instead, possibly even sorted to allow binary search).
> Sure ... one step at a time. :-)

Of course ;)


> Thanks

More information about the Gcc-patches mailing list