[jdom-interest] NoSuch*Exceptions in JDOM

Andre Van Delft avandelft at epo.org
Mon Jul 10 09:28:34 PDT 2000


Petri Wessman wrote:

> On Mon, 10 Jul 2000 08:38:44 -0500, Brett McLaughlin <brett.mclaughlin at lutris.com> said:
>
> >> Beside the "is it good design" argument, you should take into account
> >> the fact that throwing and catching exceptions carries a heavy
> >> performance penalty in Java. There is a good, practical reason for
>
> Brett> Where is your documentation for this? I don't believe that this is
> Brett> accurate, but I'm willing to be proved wrong. Could you post docs or a
> Brett> URL?
>
> Well, I don't have any handy right now, it's a point that has come up
> in various JavaWorld articles on Java performance, and I remember at
> least two speakers at last year's Java One commenting on it.

Some information is in
http://java.sun.com/docs/books/vmspec/2nd-edition/html/Overview.doc.html#15494
http://www.javaworld.com/javaworld/jw-01-1997/jw-01-hood.html

Throwing and catching a new exception involves at least:
- creating the exception
- looking up the exception in a catch table
This all performes badly as compared to returning a value.

It seems that JavaWorld would vote for a getChild that
does not throw exceptions. See:

http://www.javaworld.com/javaworld/javaqa/1999-06/04-exceptions.html
http://www.javaworld.com/javaworld/jw-07-1998/jw-07-techniques-2.html

Quote:
>The most important point to take away from this article is that
>exceptions are there for abnormal conditions and
>shouldn't be used to report conditions that can be
>reasonably expected as part of the everyday functioning
>of a method.






More information about the jdom-interest mailing list