[jdom-interest] NoSuch*Exceptions in JDOM
steve.odendahl at central.sun.com
Mon Jul 10 10:13:59 PDT 2000
I'd also add the Mark Roulo article in JavaWorld
"The cost of throwing an exception is higher than the cost of
setting up a try/catch block. Since exception handling shouldn't
be done on a speed-critical path, this doesn't bother me and I
haven't benchmarked it."
(Interestingly, this article shows that under the JITs of those
days (and probably still), the cost of setting up a try-catch
block is nearly zero. So ... "using exceptions in Java programs
can actually speed up the program when compared to an equivalent
program using status codes.")
I'm also using the same technique as Andre, except the two methods
are named "getChild" (returns null) and "getRequiredChild" (throws
exception), and I believe it helps make my code more understandable.
(Not speaking for Sun Microsystems, Inc.)
On Mon, Jul 10, 2000 at 06:28:34PM +0200 or thereabouts, Andre Van Delft wrote:
> Some information is in
> 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:
> >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.
> To control your jdom-interest membership:
More information about the jdom-interest