[cfe-dev] Hitting LexIdentifier with a minor performance hit

Chris Lattner clattner at apple.com
Fri Dec 4 23:05:33 PST 2009


On Dec 4, 2009, at 12:40 PM, Sean Hunt wrote:

> Hey,
> 
> I'd like to split LexIdentifier into two functions so that the actual identifier lexing logic can be reused for user-defined literal suffixes. Since this is a change to the lexing code that will probably have a negative performance impact, however slight (one function call of overhead per identifier is added; one goto is removed per "nasty" identifier (a \, $, or ? is present)), I wanted to check it by first.
> 
> The effective change is that the literal lexing code will be able to use LexIdentifierInternal to parse the suffix when I add that in.

This is one of the most performance sensitive pieces of the entire compiler.  Is there any other way to avoid this (e.g. through code duplication or macros)?  Have you measured the performance impact of this change?

-Chris



More information about the cfe-dev mailing list