This is the mail archive of the gcc-patches@gcc.gnu.org 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: Speed up some token processing


Zack Weinberg wrote:
Nathan Sidwell <nathan@codesourcery.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
changes?
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

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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