harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko" <mloe...@gmail.com>
Subject Re: NullPointerException
Date Mon, 20 Mar 2006 14:17:16 GMT
2006/3/20, Chris Gray <chris.gray@kiffer.be>:
> On Monday 20 March 2006 14:21, Mikhail Loenko wrote:
> > 2006/3/19, Chris Gray <chris.gray@kiffer.be>:
> > > I prefer to let these things happen automatically whenever possible.
> > > Introducing an explicit check adds extra bytecodes and probably extra CPU
> > > cycles in the non-null case. On some VMs null.someMethod() might be
> > > slower in the null case, but if the RI also throws NPE then these cases
> > > should be truly exceptional in the sense that they indicate a programming
> > > error or a missing resource.
> >
> > I do not agree that performance in case of 'exceptional' behavior
> > is not important.
> >
> > Would you use for example a browser that hangs your machine up for an hour
> > if you type wrong URL? Or if it crashes when some site misses some gif
> > file?
>
> <aside>I can remember browsers that did that (or at least waited for DNS to
> time out).</aside>
>
> I never claimed that performance in case of 'exceptional' behavior is not
> important. However it is less important than performance in the normal case;
> for example it would not make sense for Apache to optimise the processing of
> mistyped URLs at the expense of correctly-typed ones. Ideally the most

My experiments have shown that additional check for null is insignificant
while accessing time of a null address is substantial.

> frequently executed code paths should also be the shortest.
>
> There are cases where a 'catch' clause can be executed very often, such as the
> ClassNotFoundException which is thrown when a class loader delegates to its
> parent and the parent does not find the class. In such cases one might
> consider optimising this path; but NPEs generally do not fall into this
> category, they most often indicate a programmer error (not user error) or the

Actually, we are developing runtime environment, not an ordinary application
and thus those programmers who make errors and write poor-designed code are
all our users, clients, and valued customers

We should take care of them and make their applications as fast as we can.

Thanks,
Mikhail



> absence of some required resource (installation error). That is what I meant
> by "truly exceptional".
>
> Respectfully,
>
> Chris
>
> --
> Chris Gray        /k/ Embedded Java Solutions      BE0503765045
> Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
> chris.gray@kiffer.be                             +32 3 216 0369
>
>

Mime
View raw message