try ... catch (RuntimeException re) {}

Hi all,Can anyone speculate on how much of a runtime + memory hit it would be to have a try ... catch (RuntimeException) around every line of code?
[161 byte] By [tjacobs01a] at [2007-10-1 5:28:58]
# 1

It is a stupid thing to do so it should not matter.

And the answer is "not much".

All the try try itself does is add an exception entry in the method description for the class. The VM uses that to do a look up when an exception occurs so it knows where to jump.

The catch (end of try block) induces byte codes which jump around the code in the catch block. So every line would have a goto in it (presuming, I believe, a non-empty catch block.)

The catch block itself can have code. So if you put something in there then that code would be added as well. That could have an impact.

jschella at 2007-7-9 13:24:27 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2
By the way you can use "javap -c" to examine the result yourself. That tool comes with the sdk.
jschella at 2007-7-9 13:24:27 > top of Java-index,Archived Forums,Debugging Tools and Techniques...