[antlr-interest] Parser performance

Donovan, Bob bob.donovan at ugsplm.com
Fri Mar 19 14:27:39 PST 2004


I just finished testing a new parser that I generated with ANTLR.

The parser will parse the grammar, build and AST, and walk the AST to generate some statements that I use to update a model.

When I compare the performance of the antlr generated parser vs an older parser that i wrote by hand, I find that my older parser was twice as fast

ANTLR: 44 seconds
OLDER: 16 seconds

I really expected the ANTLR parser to run just as fast or maybe even faster. Not sure why it is slower. 
I optimized the ANTLR parser by putting the most common rules in front of less common rules.

Does anyone have any suggestions?
Is the AST Tree generation time consuming?
Is walking a tree time consuming?

I have one thought?
1) Instead of walking the tree to produce the model statements, I could move the generation of these statements into the first pass in the parser.

Thanks, Bob


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list