horwat 01/03/12 14:17:35
Modified: jasper/src/share/org/apache/jasper/runtime
BodyContentImpl.java
Log:
Performance patch. In 'reAllocBuff' a buffer allocation and arraycopy can be removed.
Submitted by: Casey Lucas <[EMAIL PROTECTED]>
Revision Changes Path
1.2 +5 -7
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/BodyContentImpl.java
Index: BodyContentImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/BodyContentImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BodyContentImpl.java 2000/08/12 00:52:12 1.1
+++ BodyContentImpl.java 2001/03/12 22:17:33 1.2
@@ -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]