Precompiled headers (or other speed ups)

Joe Buck jbuck@racerx.synopsys.com
Wed Jan 10 15:26:00 GMT 2001


Zack Weinberg writes:

> C++ reads files through cpplib, which is naturally as fast as I and
> Neil Booth have been able to make it...
> 
> The parser, on the other hand, is not efficient at all...
>
> I don't know enough about C++ or its implementation in GCC to say for
> sure what the ultimate cause is.  I've been told that C++ has an
> extremely ambiguous grammar and the parser has to accumulate entire
> statements on the stack before it can begin to match anything.

It is true that the C++ grammar is ugly, but it is not nearly as ugly as
gcc/cp/parse.y is.  The bison grammar has had about 10 years worth of
changes applied to track a rapidly evolving language, and it contains many
expensive kludges that no one dares touch.  Mark Mitchell's been talking
about pitching the whole thing and redoing it (after 3.0).


More information about the Gcc mailing list