tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Gilbert" <and...@soundbite.com>
Subject Tomcat 3.2.1 - bufferSize in BodyContentImpl
Date Sat, 03 Mar 2001 02:00:29 GMT
We made the following change to reAllocBuff() in
org.apache.jasper.runtime.BodyContentImpl with some success. Curious if this
is of use to others. There was already a note about using a multiple of
DEFAULT_BUFFER_SIZE. This takes the notion one step further, doubling size
upon each request. Made a tremendous impact on performance for a page where
a body tag was generating a lot of output. This function, and the array
copy, were taking a big chunk of CPU to deal with the degenerate situation.
Another option would be to get the bufferSize from JspWriter, as this would
allow the buffer page directive to affect BodyContent as well. Felt the
doubling was more effective and simple.

Thanks,

Andrew

113,117c113,114
< 	//XXX Should it be multiple of DEFAULT_BUFFER_SIZE??
<
< 	if (len <= Constants.DEFAULT_BUFFER_SIZE) {
< 	    cb = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
< 	    bufferSize += Constants.DEFAULT_BUFFER_SIZE;
---
>        if (len <= bufferSize) {
>           bufferSize = bufferSize * 2;
119d115
< 	    cb = new char [bufferSize + len];
121a118,119
>
>        cb = new char [bufferSize];


Mime
View raw message