You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Andrew Gilbert <an...@soundbite.com> on 2001/03/03 03:00:29 UTC

Tomcat 3.2.1 - bufferSize in BodyContentImpl

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];