You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2006/10/19 18:05:36 UTC

[jira] Commented: (LANG-287) Optimize StringEscapeUtils.unescapeXml(String)

    [ http://issues.apache.org/jira/browse/LANG-287?page=comments#action_12443559 ] 
            
Gary Gregory commented on LANG-287:
-----------------------------------

The problem with this idea is that when there _is_ something to escape, this would cause the performance penality of scanning the input from start to finish with 0 gain.

The general case is to unescape. If you know your application does not need this 80% of the time, the test can be put in your call site.

> Optimize StringEscapeUtils.unescapeXml(String)
> ----------------------------------------------
>
>                 Key: LANG-287
>                 URL: http://issues.apache.org/jira/browse/LANG-287
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.2
>            Reporter: Stepan Koltsov
>            Priority: Minor
>
> StringEscapeUtils.unescapeXml(String) (and other unescaes) works too slowly if String has nothing to unescape, that is very common situation.
> To make unescape faster, following check should be added to be start of Entities.unescape(str)
> if (str.indexOf('&') < 0)
>     return str;

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

        

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