kinman      2003/10/16 16:53:03

  Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
  Log:
  - Avoid some copying on a common case, when a JSP page is flushing its
    own buffer.
  
  Revision  Changes    Path
  1.9       +9 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CharChunk.java    2 Sep 2003 21:34:38 -0000       1.8
  +++ CharChunk.java    16 Oct 2003 23:53:03 -0000      1.9
  @@ -290,6 +290,14 @@
            end+=len;
            return;
        }
  +
  +        // Optimize on a common case.
  +        // If the source is going to fill up all the space in buffer, may
  +        // as well write it directly to the output, and avoid an extra copy
  +        if ( len == limit && end == 0) {
  +            out.realWriteChars( src, off, len );
  +            return;
  +        }
        
        // if we have limit and we're below
        if( len <= limit - end ) {
  @@ -487,7 +495,7 @@
   
        // limit < buf.length ( the buffer is already big )
        // or we already have space XXX
  -     if( desiredSize < buff.length ) {
  +     if( desiredSize <= buff.length ) {
            return;
        }
        // grow in larger chunks
  
  
  

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

Reply via email to