Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > Re: parser perf...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 14 Topic 2372 of 2508
Post > Topic >>

Re: parser performance, was Popularity of compiler tools, was LRgen

by Ian Lance Taylor <ian@[EMAIL PROTECTED] > Apr 12, 2008 at 01:06 PM

Ian Lance Taylor <ian@[EMAIL PROTECTED]
> writes:

> > [My understanding is that GCC switched to a hand-written parser
> > because of the difficulty of parsing the awful C++ grammar with
> > anything other than hand-written hacks.  The new parser may be a
> > little faster but that wasn't a big issue, since parse time is never a
> > bottleneck in a compiler. -John]
>
> I want to disagree with our esteemed moderator a little bit.  Parsing
> time is not a bottleneck when optimizing.  But the speed of the
> compiler matters more when not optimizing, and in that case the parser
> can indeed be a bottleneck.  When compiling C++ with gcc with a lot of
> header files, the parsing time can be up to 50% of the total
> compilation time when not optimizing.
>
> Ian
> [Are you including tokenizing in the 50%?  Lexers often do take a lot
> of time, since they have to do something to each character.  But once
> the lexer has shrunk the input from a stream of characters to a stream
> of tokens, the parser rarely takes an appreciable amount of time.
> Opinions vary about the relative performance of DFA lexers vs ad-hoc
> hand written ones, which I think means that the implementation is more
> im****tant than the technique.  -John]

The 50% does include tokenizing, but still parsing is more than half
of that.  C++ files can easily include hundreds of thousands of lines
of header files, and gcc parses all of them even though very few of
them will be used by anything after the parsing stage.

I should add that I agree with your main point that there probably
isn't much speed difference between a hand-written parser and a
generated parser.  I just want to make the point that parsing speed
actually is relevant in practice.

gcc now uses a hand-written parser for C too, by the way.

Ian
 




 14 Posts in Topic:
Re: Seeking recommendations for a Visual Parser to replace Visua
"Marcel Satchell&quo  2008-03-28 06:59:11 
Re: LRgen, was Seeking recommendations for a Visual Parser to re
"Paul B Mann" &  2008-03-31 02:35:38 
Re: LRgen, was Seeking recommendations for a Visual Parser to re
Hans-Peter Diettrich <  2008-04-01 10:32:26 
Popularity of compiler tools, was LRgen
anton@[EMAIL PROTECTED]   2008-04-06 15:25:04 
Re: Popularity of compiler tools, was LRgen
Jason Evans <joevans@[  2008-04-07 08:24:11 
Re: Popularity of compiler tools, was LRgen
Tegiri Nenashi <Tegiri  2008-04-08 13:13:38 
Re: Popularity of compiler tools, was LRgen
Hans-Peter Diettrich <  2008-04-11 15:57:04 
Re: Popularity of compiler tools, was LRgen
idbaxter@[EMAIL PROTECTED  2008-04-11 10:52:35 
Re: Popularity of compiler tools, was LRgen
Tegiri Nenashi <Tegiri  2008-04-11 17:00:09 
Re: Popularity of compiler tools, was LRgen
Walter Banks <walter@[  2008-04-11 09:28:14 
Re: Popularity of compiler tools, was LRgen
wclodius@[EMAIL PROTECTED  2008-04-11 22:09:16 
Re: parser performance, was Popularity of compiler tools, was LR
Ian Lance Taylor <ian@  2008-04-12 08:28:56 
Re: parser performance, was Popularity of compiler tools, was LR
Ian Lance Taylor <ian@  2008-04-12 13:06:06 
Re: parser performance, was Popularity of compiler tools, was LR
"Derek M. Jones"  2008-04-12 23:02:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 7:03:50 CDT 2008.