avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: Excalibur Phase III Release Candidate 1
Date Thu, 24 Apr 2003 13:25:56 GMT
Leo Simons wrote:
> Nicola Ken Barozzi wrote:
> 
>> Leo Simons wrote, On 24/04/2003 14.46:
>>
>>> marking classes as final often results in more inlining which speeds 
>>> things up considerably depending on your jvm.
>>
>>
>> ;-)) Read the article...
> 
> 

<snip/>

> 
> On the other hand, the run-time environment and JIT compiler have more 
> information about what classes are actually loaded, and can make much 
> better optimization decisions than the compiler can. If the run-time 
> environment knows that no classes are loaded that extend Y, then it can 
> safely inline calls to methods of Y, regardless of whether Y is final 
> (as long as it can invalidate such JIT-compiled code if a subclass of Y 
> is later loaded). So the reality is that while final might be a useful 
> hint to a dumb run-time optimizer that doesn't perform any global 
> dependency analysis, its use doesn't actually enable very many 
> compile-time optimizations, and is not needed by a smart JIT to perform 
> run-time optimizations."
> 
> jada jada jada :P. Nice theory, but my reality is that marking methods 
> as final *does* speed things up. Of course, we don't want to optimize 
> prematurely, but in the case of (for example) 
> AbstractLogEnabled.getLogger(), the final really has been proven to help 
> in some jvms.


Performance hints is never a real reason to use final.  However managing
the growth of an API is.  That is the reason that I promote the use
of final.  If it gets in the way later, we can remove it.  I personally
prefer to lock things down by default, and when there is a reason to
open it we can open it.


-- 
"You know the world is going crazy when the best
rapper is a white guy, the best golfer is a black guy,
The Swiss hold the America's Cup, France is
accusing the US of arrogance, and Germany doesn't want
to go to war. And the 3 most powerful men in America
are named 'Bush', 'Dick', and 'Colon' (sic)".

-----Chris Rock


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message