https://issues.apache.org/bugzilla/show_bug.cgi?id=53867

          Priority: P2
            Bug ID: 53867
          Assignee: dev@tomcat.apache.org
           Summary: Performance tuning solution for
                    PageContextImpl.XmlEscape
          Severity: enhancement
    Classification: Unclassified
          Reporter: xs...@ebay.com
          Hardware: PC
            Status: NEW
           Version: trunk
         Component: Jasper
           Product: Tomcat 7

Created attachment 29369
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29369&action=edit
Patch for PageContextImpl.java

XmlEscape is used to do escape special characters for EL result.
 Currently it gets characters from String one by one and check whether the char
is special character or not, than put the char into a StringBuilder.

Most cases the string has no such special characters, However, it always
creates a new StringBuilder than do such iteration.

It's better to check whether there is any special characters first.
 If there is special character, then do create a StringBuilder and put those
characters in front of te special character into the StringBuilder. 
Again, check the string by character one by one similar as the original logic.



Here is the result of comparison testing between the two methods.

Old escape:1610
New escape:1050
Old escape:1566
New escape:873
Old escape:1437
New escape:905
Old escape:1590
New escape:890
Old escape:1452
New escape:889
Old escape:1547
New escape:889
Old escape:1467
New escape:889
Old escape:1575
New escape:930
Old escape:1479
New escape:874
Old escape:1517
New escape:970

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to