I also think that avoiding the use of final at all is not something
practical. In some cases marking a method as final improves the performance
by a sigficiant amount. Many of the Java books and reference materials
actually encourage the usage of final for performance reasons.  Of course I
would agree that we should use it carefully, in order not to limit the
extensibility. There are already many final methods in Xalan source code. I
do not think there is a reason not to introduce any new final method at
all.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]



                                                                                
                                                         
                      "Santiago                                                 
                                                         
                      Pericas-Geertsen"              To:       
<[email protected]>                                                
                      <Santiago.PericasGeerts        cc:       <[EMAIL 
PROTECTED]>                                                
                      [EMAIL PROTECTED]>                    Subject:  Re: cvs 
commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom             
                                                      DOMAdapter.java 
SAXImpl.java                                                       
                      03/07/2003 03:58 PM                                       
                                                         
                      Please respond to                                         
                                                         
                      xalan-dev                                                 
                                                         
                                                                                
                                                         
                                                                                
                                                         



----- Original Message -----
From: "Joseph Kesselman" <[EMAIL PROTECTED]>


> Note that final methods also cause problems if/when you need to introduce
> subclassing/polymorphism, and that SUN's own performance team generally
> recommends strongly *AGAINST* trying to use the final keyword as an
> optimization trick.

 Sun's Hotspots has a mechanism by which it essentially infers the final
keyword (often, e.g. if a certain class loaded, it can also "uninfer" it).
The main advantage of a final method is that it can be inlined, thus saving
the overhead of method invocation and late binding. I can't think of any
reason for which not to use final: for variables it promotes constant
propagation (typically at compile time and when the init expression has not
side effects), for methods it promotes inlining.

 This is just my opinion though, I can always contact the performance team
if we want to make sure. Do you have a reference Joe?

-- Santiago



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to