[antlr-interest] Performance and LA(int)

Paul J. Lucas pauljlucas at mac.com
Wed Feb 23 10:42:36 PST 2005

On Wed, 23 Feb 2005, Terence Parr wrote:

> Because it's easier to generate code that way.

	Bah... that's no excuse.  :-P  The burden should be on the
	compiler author.

> I was kinda hoping the compiler would see the obvious common subexpression.

	How can it know LA(int) doesn't have side-effects?

> Apparently not, eh?  Are you sure it actually does call it repeatedly?

	Well, when profiling with JProfiler, it gets called a *lot* and
	is the #1 called method in our application during the
	compilation phase.

> "a kingdom for a decent compiler optimizer" ;)

	I think you need to assume the Java compiler is dumb (and you'd
	be right).

	- Paul

More information about the antlr-interest mailing list