Re: Why are LR parsers faster than using if conditions

Hans Aberg <haberg@matematik.su.se>
28 Jun 2004 20:05:38 -0400

          From comp.compilers

Related articles
Why are LR parsers faster than using if conditions shripal.meghani@philips.com (2004-06-06)
Re: Why are LR parsers faster than using if conditions torbenm@diku.dk (2004-06-09)
Re: Why are LR parsers faster than using if conditions alexc@std.com (Alex Colvin) (2004-06-11)
Re: Why are LR parsers faster than using if conditions cdc@maxnet.co.nz (Carl Cerecke) (2004-06-15)
Re: Why are LR parsers faster than using if conditions cdc@maxnet.co.nz (Carl Cerecke) (2004-06-21)
Re: Why are LR parsers faster than using if conditions t.zielonka@zodiac.mimuw.edu.pl (Tomasz Zielonka) (2004-06-25)
Re: Why are LR parsers faster than using if conditions haberg@matematik.su.se (Hans Aberg) (2004-06-26)
Re: Why are LR parsers faster than using if conditions haberg@matematik.su.se (Hans Aberg) (2004-06-28)
Re: Why are LR parsers faster than using if conditions clint@0lsen.net (Clint Olsen) (2004-06-28)
Re: Why are LR parsers faster than using if conditions tmoog@panix.com (2004-06-30)
Re: Why are LR parsers faster than using if conditions haberg@matematik.su.se (Hans Aberg) (2004-06-30)
Re: Why are LR parsers faster than using if conditions christian.bau@cbau.freeserve.co.uk (Christian Bau) (2004-07-11)
Re: Why are LR parsers faster than using if conditions try_vanevery_at_mycompanyname@yahoo.com (Brandon J. Van Every) (2004-07-13)
Re: Why are LR parsers faster than using if conditions paulbmann@yahoo.com (Paul B Mann) (2004-07-28)
| List of all articles for this month |

From: Hans Aberg <haberg@matematik.su.se>
Newsgroups: comp.compilers
Date: 28 Jun 2004 20:05:38 -0400
Organization: Compilers Central
Keywords: parse, performance
Posted-Date: 28 Jun 2004 20:05:37 EDT

>I recall somebody said that typical compilers spend most time
>elsewhere than in the parser, e.g., the actions.
...
>[The numbers I've seen say that the lexer is usually the slowest part
>of a compiler. -John]


One should be aware of, though, that non-deterministic parsers may
dramatically slow down a parser. For example, I translated the
Mini-Prolog that comes with Hugs <http://haskell.org/hugs> from
Haskell into C++, and both versions were mysteriously slow. Then I
replaced its non-deterministic parser with a Flex/Bison generated
lexer/parser combination, and the program suddenly became lightening
fast. So if non-deterministic parsing is needed, one should, for the
sake of speed, probably in the first hand try out some GLR parser,
which sticks to deterministic parsing as far is possible.


    Hans Aberg


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.