UnicodeEncoder.encode() could be made faster
--------------------------------------------
Key: MYFACES-263
URL: http://issues.apache.org/jira/browse/MYFACES-263
Project: MyFaces
Type: Improvement
Versions: 1.0.9 beta
Environment: WinXP, Pentium 4, Tomcat 5.5, Java 5
Reporter: Kevin Roast
I have been running some performance tests against our MyFaces application. I
noticed the following method could be quicker:
UnicodeEncoder.encode()
The HtmlResponseWriterImpl calls this method for all response.write(String)
calls - so it's used a lot!
Most of the components we have created for use with MyFaces output some quite
long strings to this write.out() method, so the declaration:
StringBuffer sb = new StringBuffer();
in the method:
public static String encode (String string, boolean encodeNewline,
boolean encodeSubsequentBlanksToNbsp) {…}
is therefore inefficient. Would is possible for it to be changed create the
StringBuffer on demand when it meets the first character that requires
encoding? Or at the very least create a more sensible sized buffer:
StringBuffer sb = new StringBuffer(string.length() + 4);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira