Thanks.

I missed the obvious in the double array copy. Still, by doubling the buffer
size each time instead of incrementally increasing we are getting double the
speed with our degenerate test case.

1. Original - 22 seconds
2. As patched here - 13 seconds
3. With doubling of buffer as well - 6 seconds

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 03, 2001 10:26 PM
To: [EMAIL PROTECTED]
Subject: cvs commit: jakarta-tomcat/src/share/org/apache/jasper/runtime
BodyContentImpl.java


marcsaeg    01/03/03 19:26:22

  Modified:    src/share/org/apache/jasper/runtime Tag: tomcat_32
                        BodyContentImpl.java
  Log:
  BodyContentImpl.java

  Revision  Changes    Path
  No                   revision


  No                   revision


  1.6.6.1   +6 -8
jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl.java

  Index: BodyContentImpl.java
  ===================================================================
  RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl
.java,v
  retrieving revision 1.6
  retrieving revision 1.6.6.1
  diff -u -r1.6 -r1.6.6.1
  --- BodyContentImpl.java      1999/11/13 00:32:51     1.6
  +++ BodyContentImpl.java      2001/03/04 03:26:21     1.6.6.1
  @@ -88,7 +88,7 @@
           super(writer);
        cb = new char[bufferSize];
        nextChar = 0;
  -    }
  +      }

       /**
        * Write a single character.
  @@ -107,19 +107,19 @@
           //Need to re-allocate the buffer since it is to be
        //unbounded according to the updated spec..

  -        char[] tmp = new char [bufferSize];
  -     System.arraycopy(cb, 0, tmp, 0, cb.length);
  +        char[] tmp = null;

        //XXX Should it be multiple of DEFAULT_BUFFER_SIZE??

        if (len <= Constants.DEFAULT_BUFFER_SIZE) {
  -         cb = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
  +         tmp = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
            bufferSize += Constants.DEFAULT_BUFFER_SIZE;
        } else {
  -         cb = new char [bufferSize + len];
  +         tmp = new char [bufferSize + len];
            bufferSize += len;
        }
  -     System.arraycopy(tmp, 0, cb, 0, tmp.length);
  +     System.arraycopy(cb, 0, tmp, 0, cb.length);
  +     cb = tmp;
        tmp = null;
       }

  @@ -499,8 +499,6 @@

       public void clear() throws IOException {
           synchronized (lock) {
  -            cb = new char [Constants.DEFAULT_BUFFER_SIZE];
  -         bufferSize = Constants.DEFAULT_BUFFER_SIZE;
            nextChar = 0;
        }
       }




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


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

Reply via email to