[antlr-interest] how to do exceptions quickly

Benjamin Niemann pink at odahoda.de
Tue Apr 17 13:49:12 PDT 2007


Terence Parr wrote:

> I had a long conversation at Google last night with Neal Gafter, the
> guy who built the javac compiler when he was at Sun. He told me that
> exceptions can be made to execute very quickly.  The only thing you
> have to avoid is the actual exception object creation which has to do
> all of the expensive stack trace creation and so on.  He says that
> the actual throwing of the exception itself is not a problem.  This
> might be something to look at later to see if it goes quickly,
> because it results in cleaner backtracking code.

In fact this is already in my TODO as one of the possible optimizations for
the Python target :) In Python exceptions have very little overhead and it
is not frowned upon (as in Java or C++) to use them regularily.

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/



More information about the antlr-interest mailing list