[ 
http://issues.apache.org/jira/browse/LANG-287?page=comments#action_12443593 ] 
            
Holger Hoffstätte commented on LANG-287:
----------------------------------------

Just jumping in here - how about zooming forward until the & is found and only 
then creating the StringBuffer, copying the skipped characters and continuing 
from the hit index? Seems to be the easiest thing to do. Also if no & was found 
you can just return the input argument without creating a new 
StringBuffer/String for no good reason.
(looking at 2.1 right now, sorry if this changed in 2.2)


> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to