classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: Opening RandomAccessFiles requires excessive per


From: Archie Cobbs
Subject: Re: [cp-patches] Patch: Opening RandomAccessFiles requires excessive permission
Date: Tue, 06 Dec 2005 13:32:35 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Christian Thalinger wrote:
That's getting into the micro-optimzation realm, which is
fraught with danger and mistaken assumptions :-) E.g., on
some machines the time overhead of setting up a try/catch in
a method that wouldn't otherwise have one is higher than
the single comparison required to test for null. In particular,
any interpreter is going to have to test for null anyway,
so the second time it's already in cache, blah blah, etc.

"...setting up a try/catch..."?  What do you mean?  Agreed on the

Simply that on some VM's there is overhead associated with
executing code that can possibly catch an exception, even if no
exception is actually thrown. For example, locals might be stored
on the stack instead of in registers if the engine doesn't know how
to unwind registers.

Not to mention that the space overhead of a try/catch (vs. none)
will probably be higher too. So IMHO it's better to avoid
too much of this kind of thing (unless it actually makes the
source code clearer (don't think so in this case)).

Actually the generated code is smaller and i don't think there is too
much space overhead in the VM (at least not in CACAO).  Yes, the code is
not clearer but it's just a 6-liner in a core class... so it should be
understandable for everyone :-)

You say "the generated code is smaller" but that depends on who generates
the code (if you mean the generated Java bytecode, I'd guess you're wrong
there too because of the extra exception table required). And that depends
on which VM you're using.. which is my only point: it all depends, so you
can't assume anything for sure.

I didn't really mean to criticize this change so much as the idea of
initiating a wild goose chase of similar changes which may or may not
actually improve anything.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]