[antlr-interest] Which one is quicker?
jaluber at gmx.de
Fri Dec 26 03:09:14 PST 2008
chain one schrieb:
> : '-'? DIGIT+
> : ('-'|'+')? DIGIT+ '.' DIGIT* (('e' | 'E') ('+' | '-')? (DIGIT)+)?
> : '-'? DIGIT+ FLOAT?
> : '.' DIGIT* EXPONENT?
> EXPONENT: ('e' | 'E') ('+' | '-')? (DIGIT)+;
> Which one is quicker?
> I think the 2th is quicker. Because in the 1st lex rule, A DFA is needed
> to predict if it is a INT or FLOAT.
> Am I right?
> Best Regards,
Did you benchmark the code? I've heard that people don't see the true
bottlenecks just by looking at code alone. Run the recognition a million
times and you should see a difference.
More information about the antlr-interest