You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by ig...@apache.org on 2004/04/28 23:59:28 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates AVT.java

igorh       2004/04/28 14:59:28

  Modified:    java/src/org/apache/xalan/templates AVT.java
  Log:
  Scaling Problem in org/apache/xalan/templates/AVT.evaluate
  The problem is that synchronized calls 
  StringBufferPool.get() and StringBufferPool.free(buf)  
  are redundant if (null != m_simpleString).
  The bug results in severe performance derogation in multi-thread test.
  
  The fix is simple just not to the calls when (null != m_simpleString).
  
  
  Revision  Changes    Path
  1.23      +13 -12    xml-xalan/java/src/org/apache/xalan/templates/AVT.java
  
  Index: AVT.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVT.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AVT.java	16 Feb 2004 20:32:32 -0000	1.22
  +++ AVT.java	28 Apr 2004 21:59:28 -0000	1.23
  @@ -470,15 +470,16 @@
               throws javax.xml.transform.TransformerException
     {
   
  -    FastStringBuffer buf = StringBufferPool.get();
  -
  +    if (null != m_simpleString)
  +    {
  +            return m_simpleString;
  +    }
  +    
  +    FastStringBuffer buf = null;
       try
       {
  -      if (null != m_simpleString)
  -      {
  -        return m_simpleString;
  -      }
  -      else if (null != m_parts)
  +      buf = StringBufferPool.get();
  +      if (null != m_parts)
         {
           buf.setLength(0);
   
  @@ -497,10 +498,10 @@
         {
           return "";
         }
  -    }
  -    finally
  -    {
  -      StringBufferPool.free(buf);
  +    }finally{
  +      if(buf != null){
  +        StringBufferPool.free(buf);
  +      }      
       }
     }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org