[ 
https://issues.apache.org/jira/browse/TRINIDAD-1275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthias Weßendorf resolved TRINIDAD-1275.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.10-core
         Assignee: Matthias Weßendorf

> Optimize org.apache.myfaces.trinidadinternal.share.url.EncoderUtilsto use 
> less CPU time
> ---------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1275
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1275
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>            Reporter: Stevan Malesevic
>            Assignee: Matthias Weßendorf
>             Fix For: 1.2.10-core
>
>         Attachments: EncodeUtils.patch
>
>
> While looking at some test cases we noticed that EncoderUtils::_writeURL uses 
> a lot of CPU to do its work. The basic problem is that frequent calls to 
> charAt and calls to underlying writer to write just char or int can be very 
> expensive.
> The overall optimization idea is:
> 1. Instead of doing charAt do toCharArray once. This will use a little bit 
> more of transient memory but it will be faster
> 2. Instead of doing frequent writes to the writer create one StringBuilder 
> and work on it. Once _writeURL is done with all the transformations do the 
> finale write(string) to the underlying writer
> In our test case we had 4200 calls to _writeURL which used 2356ms of CPU 
> time. With the optimizations the same number of calls uses 268ms.  This is 
> almost 9x improvement
> Attached is the patch for the changes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to