struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Evans (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (STR-1798) Enhanced performance for TagUtils.filter()
Date Tue, 25 Apr 2006 18:48:45 GMT
     [ http://issues.apache.org/struts/browse/STR-1798?page=all ]
     
David Evans reopened STR-1798:
------------------------------

    Assign To: David Evans  (was: Struts Developer Mailing List)

> Enhanced performance for TagUtils.filter()
> ------------------------------------------
>
>          Key: STR-1798
>          URL: http://issues.apache.org/struts/browse/STR-1798
>      Project: Struts Action 1
>         Type: Improvement

>   Components: Taglibs
>     Versions: Nightly Build
>  Environment: Operating System: All
> Platform: All
>     Reporter: Sean Owen
>     Assignee: David Evans
>     Priority: Minor
>      Fix For: 1.2 Family
>  Attachments: TagUtils.patchfile.txt, TestTagUtils.java, build-tests.xml.patchfile.txt
>
> The TagUtils.filter() method, which replaces certain characters with
> corresponding XML entity references, can be easily enhanced to run much faster
> and require less memory.
> To summarize it can be made faster in two ways:
> * Instead of building up the escape string character by character, with a call
> to StringBuffer.append() for each character, it can be rewritten to copy chunks
> of input at a time, avoiding many method calls, which is most of the overhead of
> this method.
> * In fact the method does not even need to allocate a StringBuffer until it
> knows that some character in the input must be escaped. In the common case where
> the input has no such characters, this avoids allocating any additional memory
> at all.
> Performance improvements is large when the string has no characters to be
> escaped -- 1000% or more on the small and medium-sized strings I tested on. It
> offers more modest improvement when the string has some escapable characters --
> 50-100% on small and medium-sized strings. It is only slower in contrived cases
> like "<<<<>>>>".
> While it is a small method, it is called many times by the Struts framework.
> This is an easy and reliable change to squeeze out a little better performance
> in time and memory for all applications.
> Note that I created a JUnit test for this change (included) in order to verify
> that the new method works as well as the current one.
> Please find attached files which implement this enhancement:
> * TagUtils.patchfile.txt
>   Patch against the 10/19/2003 nightly build to implement the change to filter()
> * TestTagUtils
>   A new JUnit test case covering the filter() method
> * build-test.xml.patchfile.txt
>   Patch against the 10/19/2003 build-test.xml file to invoke TestTagUtils
> I posted this change to the list once before with no result -- I hope this even
> better version, with unit test this time, can be considered for inclusion in
> Struts -- thanks!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message