You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Kevin Roast (JIRA)" <my...@incubator.apache.org> on 2005/06/01 11:55:58 UTC

[jira] Created: (MYFACES-263) UnicodeEncoder.encode() could be made faster

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


[jira] Closed: (MYFACES-263) UnicodeEncoder.encode() could be made faster

Posted by "Sylvain Vieujot (JIRA)" <my...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-263?page=all ]
     
Sylvain Vieujot closed MYFACES-263:
-----------------------------------

     Resolution: Fixed
    Fix Version: Nightly Build

Done.

Thanks for the info.
Please tell us if you see any speed improvements and/or any other bottlenecks.

> 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
>      Fix For: Nightly Build

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