Jan Obdržálek wrote:
> Hello,
>
> for our student research project we implemented a C grammar in ANTLR
> 3.1. (The grammar fully implements ANSI C99, and mostly implements the
> GNU C extensions - the notable exception being the attributes, which
> are a real pain.) However we found the performance of the parser to be
> a bit lacking. We therefore ran some tests. In addition to the default
> Java target, we modified the grammar for the C target. The results
> were then compared to the results obtained by using the GNU C
> compiler. This is a fair comparison, since gcc also uses a top-down
> recursive parser (although hand-coded). Actually the test is tougher
> on gcc, since gcc does full compilation, compared to just building the
> AST in the case of ANTLR.
>
> The results can be summarized as follows (more details about the test
> at the end of this post):
>
> - ANTLR/Java is obviously the slowest one [and there is a serious
> start-up/close-down overhead]
> - ANTLR/C is faster, but still miles behind the gcc
Looking at your gprof file, it claims that the function call
setCharPositionInLine() is called 4 times and takes 0.67 seconds,
however this function is just this:
static void setCharPositionInLine (pANTLR3_COMMON_TOKEN
token, ANTLR3_INT32 pos)
{
token->charPosition = pos;
}
So, I am having a hard time buying that. Try kcachegrind and see if this
gives a different perspective, but as I say, we need to see the grammar
really. I also suggest trying the beta 3.1.2 runtime which is in
perforce/fisheye, though this probably means you need to use a current
build of the ANTLR tool, which you can get from hudson:
www.antlr.org/hudson.
Jim
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---