This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Cost of having try-catch statements?
- From: Andrew Haley <aph at redhat dot com>
- To: Martin Egholm Nielsen <martin at egholm-nielsen dot dk>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 10 Aug 2004 15:56:45 +0100
- Subject: Cost of having try-catch statements?
- References: <cfan45$ghk$1@sea.gmane.org>
Martin Egholm Nielsen writes:
> I was wondering: Is there any significant cost in having "unused"
> try-catches in my code?
> That is, I have a method that 99.99% of the times invoked never throws a
> given exception. However, in case it does, I need to log it...
The only cost is the unwinder tables, (which are not read into memory
unless your exception is thrown) and the handler itself, which may
cause some instruction cache presure.
Andrew.