[antlr-interest] C++ is slower than Java?

Trey Spiva Trey.Spiva at embarcadero.com
Mon Feb 25 06:37:07 PST 2002


Did you use one of the java Buffered input classes.  Because as far as I can
tell the C++ streams
class are not buffered.  Therefore, every time the C++ antlr runtime reads a
character it is
going to the disk to retrieve the character.  I drastically increased the
speed of the parser by
implementing my own buffer.

> -----Original Message-----
> From: keren_jefet [mailto:keren_jefet at yahoo.com]
> Sent: Sunday, February 24, 2002 6:24 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] C++ is slower than Java?
> 
> 
> Hi,
> 
> I have tested the java.g example both on Java-generated parser, and 
> on Cpp-generated parser (antlr-2.7.1, buildAST=true).  
> Surprisingly, I found out that the Java parser, was significantly 
> faster than the Cpp one, especially when handling long java source 
> files. (sometimes even 600% faster...)
> 
> How can that be? 
> Is this related to the specific java.g grammar definitions, or maybe 
> it is true for all parsers, no matter of the grammar complexity?
> 
> Thanks,
> keren.
> 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 

 

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



More information about the antlr-interest mailing list