You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2015/03/22 10:54:11 UTC

[jira] [Resolved] (LANG-935) Possible performance improvement on string escape functions

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

Benedikt Ritter resolved LANG-935.
----------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: Review Patch)

{code}
$ svn ci -m "LANG-935: Possible performance improvement on string escape functions. Thanks to Fabian Lange and Thomas Neidhart."
Sending        src/changes/changes.xml
Sending        src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java
Transmitting file data ..
Committed revision 1668348.
{code}

I've submitted Thomas' patch and modified it to use a HasSet.

> Possible performance improvement on string escape functions
> -----------------------------------------------------------
>
>                 Key: LANG-935
>                 URL: https://issues.apache.org/jira/browse/LANG-935
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.text.translate.*
>    Affects Versions: 3.1
>            Reporter: Peter Wall
>            Priority: Minor
>              Labels: performance
>             Fix For: 3.4
>
>         Attachments: LANG-935.patch, tempproject1.zip
>
>
> The escape functions for HTML etc. use the same code and the same initialisation tables for the escape and unescape functions, and while this is an elegant approach it leads to a number of deficiencies:
> 1. The code is very much less efficient than it could be
> 2. A new output string is created even when no conversion is required
> 3. No mapping is provided for characters that do not have a specific representation (for example HTML 0x101 should become &amp;#257; )
> The proposal is to use a new mapping technique to address these issues



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)