Remy,

I like this much better!  No private API used, and cleaner generated
codes!

Some nitpicks!  :-)  See below.

There seems to be no need for a JspxState object anymore.
Jspx.State.tagCount is really not used, and JspxState.out can be
make local.  I should just comment that out for now.

> remm        2002/06/10 20:35:35
> 
>   Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
>                jasper2/src/share/org/apache/jasper/runtime
>                         PageContextImpl.java
>   Log:
>   - Take advantage of the fact that the PageContext is pooled.
>   - Modify the way the buffer reuse is done to conform with the PageContext
>     contract (basically, the code moves from the generated servlet to 
PageContext).
>   


>   Index: Generator.java
>   ===================================================================
>   RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Gen
erator.java,v

>   +                    out.printil("javax.servlet.jsp.tagext.BodyContent _bc = 
pageContext.pushBody();");
>   +                    out.printil("_bc.clear();");
>   +                    out.printil("out = _bc;");
>    

Can call to clear() be moved to pushBody()?
 
>   Index: PageContextImpl.java
>   ===================================================================
>   RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/Page
ContextImpl.java,v

>   +    protected BodyContent[] outs = new BodyContentImpl[0];

Why not start the array with a small fixed size, say 5, to avoid all
these copying.

>   +    protected int depth = -1;
>    
>        public BodyContent pushBody() {
>   -        JspWriter previous = out;
>   -        writerStack.push(out);
>   -        out = new BodyContentImpl(previous);
>   -        return (BodyContent) out;
>   +        depth++;
>   +        if (depth >= outs.length) {
>   +            BodyContent[] newOuts = new BodyContentImpl[depth + 1];
>   +            for (int i = 0; i < outs.length; i++) {
>   +                newOuts[i] = outs[i];
>   +            }
>   +            newOuts[depth] = new BodyContentImpl(out);
>   +            outs = newOuts;
>   +        }
>   +        out = outs[depth];
>   +        return outs[depth];
>        }




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

Reply via email to