On Fri, 18 Aug 2000 [EMAIL PROTECTED] wrote:
> I wrote a simple test case like:
> class x
> {
> /*
> x() throws SecurityException {
> try {
> System.getSecurityManager().checkCreateClassLoader();
> } catch(NullPointerException e) {
> }
> */
> x() throws SecurityException {
> SecurityManager sm = System.getSecurityManager();
> if (sm != null) { sm.checkCreateClassLoader(); }
> }
> }
[...]
> As regarding speed I really doubed that one can gain
> anything: with Jit and brunch prediction I would expect
> that even when SecurityManager is installed, the "if" case would run as fast as
>catch one, and without SecurityManager (which a common case for many Java
>applications), it would run I guess at least 10 times faster.
Catching exceptions is extremely slow, as is anything in general which has
to do with exceptions. I would say that the second idiom should always be
favoured.
pat