Author: kkolinko Date: Tue Apr 9 20:47:50 2013 New Revision: 1466224 URL: http://svn.apache.org/r1466224 Log: Two minor optimizations in JspDocumentParser.processChars(): a) Replace repeated getter calls with a local variable. b) No need to reallocate CharArrayWriter to clear it. You can call reset().
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1466224&r1=1466223&r2=1466224&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Tue Apr 9 20:47:50 2013 @@ -471,10 +471,8 @@ class JspDocumentParser if (!(current instanceof Node.JspText) && !(current instanceof Node.NamedAttribute)) { for (int i = 0; i < charBuffer.length(); i++) { - if (!(charBuffer.charAt(i) == ' ' - || charBuffer.charAt(i) == '\n' - || charBuffer.charAt(i) == '\r' - || charBuffer.charAt(i) == '\t')) { + char ch = charBuffer.charAt(i); + if (!(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t')) { isAllSpace = false; break; } @@ -522,7 +520,7 @@ class JspDocumentParser @SuppressWarnings("unused") Node unused = new Node.TemplateText( ttext.toString(), startMark, current); - ttext = new CharArrayWriter(); + ttext.reset(); //We subtract two from the column number to //account for the '[$,#]{' that we've already parsed startMark = new Mark(ctxt, path, line, column - 2); @@ -558,7 +556,7 @@ class JspDocumentParser Node unused = new Node.ELExpression( (char) elType, ttext.toString(), startMark, current); - ttext = new CharArrayWriter(); + ttext.reset(); startMark = new Mark(ctxt, path, line, column); break; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org