Minas Hambardzumyan
2007-12-19 23:22:43 UTC
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
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