This is the mail archive of the
mailing list for the GCC project.
Re: Speed up some token processing
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Oct 2004 09:21:26 +0100
- Subject: Re: Speed up some token processing
- Organization: Codesourcery LLC
- References: <417CF7AC.email@example.com> <firstname.lastname@example.org>
Zack Weinberg wrote:
Nathan Sidwell <email@example.com> writes:
This patch speeds up token processing by moving some duplicated code
into a single switch statement. It shows a surprisingly good speedup
of the Qt library of 1.5%.
The major concern I have is that TV_LEX and TV_CPP are now not
usefully distinguishable. Perhaps we should remove one of them? Or
both, since timevar operations have substantial overhead and so the
numbers we get from them are probably not meaningful when they're
pushed and popped on every token?
This is most likely correct. Can we address that in a separate patch?
Also, could you talk a little about the rationale for the testsuite
Sure. Prior to this patch, '#' and '##' would be passed through
to the C parser (whereas they'd be eaten by the C++ lexer). For both
lexers, '@' would be eaten. This patch eats all those stray tokens before
they hit the parser. The parser therefore didn't resynchronize the same
way as before, so I inserted the dummy variable declarations to allow
it to do error recovery before getting to the next stray token. (I'd
forgotten that this patch changed that behaviour when writing it up, sorry.)
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
firstname.lastname@example.org :: http://www.planetfall.pwp.blueyonder.co.uk