[antlr-interest] attempt to compare antlr vs bison/flex performance

Terence Parr parrt at cs.usfca.edu
Thu Dec 20 09:39:36 PST 2007


Hi Minas.  Can you try it on the Java grammar(s)?  I spent a bit of  
time making that fast.

Ter
On Dec 19, 2007, at 3:22 PM, Minas Hambardzumyan wrote:

> Hello,
>
> In an effort to compare antlr and bison/flex parsers, I did the  
> following exercise:
>
> - found and compiled bison/flex "C" language parser from the  
> following location:
>    ftp://ftp.uu.net/usenet/net.sources/ansi.c.grammar.Z
> - downloaded and compiled antlr3 implementation of "C" language  
> parser from this directory in antlr3 examples:
>   antlr/examples-v3/C/C
> - preprocessed a "C" language file and stripped it such that both  
> parser would pass it through (mostly minor changes)
> - compared runtime for each parser
>
>
> The results of this exercise show that the antlr parser is ~9 times  
> slower than the flex/bison parser. I have used the same version of  
> GNU C compiler for both parsers, with exact same compile options.
>
> Although the grammar definitions come from different sources, I  
> still think this exercise gives a general idea about performance  
> differences of these parsers. Could anyone please tell me if this  
> is an expected runtime difference or you think I could do some  
> optimizations to get faster performance from antlr3.
>
> I can send the complete code I used for both parsers, or any parts  
> of it, if necessary. Just tell me which part would be of interest.
>
> Thanks,
> Minas



More information about the antlr-interest mailing list