You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Makoto Uchino (JIRA)" <ji...@apache.org> on 2007/11/29 02:51:43 UTC

[jira] Created: (VALIDATOR-252) Performance improvement of DomainValidator by change the regular expression

Performance improvement of DomainValidator by change the regular expression
---------------------------------------------------------------------------

                 Key: VALIDATOR-252
                 URL: https://issues.apache.org/jira/browse/VALIDATOR-252
             Project: Commons Validator
          Issue Type: Improvement
          Components: Routines
    Affects Versions: 1.4
         Environment: Windows 2000 Professional, Pentium4 2.4GHz, RAM:512M, Eclipse 3.3m Junit 3.8.1
            Reporter: Makoto Uchino
            Priority: Minor
             Fix For: 1.4


It seemed to take very long time to match the regular expression when long TLD (consists of around 30-characters over TLD) was specified for DomainValidator, this exponential performance will make it appear that the program has hung.

The match time improves if it is possible to change DOMAIN_LABEL_REGEX from using (?:) to (?>), as follows.

DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*"

(All unit tests in DomainValidatorTest are succeed even if it changes as shown in the above-mentioned.)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (VALIDATOR-252) Performance improvement of DomainValidator by change the regular expression

Posted by "Makoto Uchino (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VALIDATOR-252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Makoto Uchino updated VALIDATOR-252:
------------------------------------

    Attachment: DomainValidator.java.diff

Patch file for DomainValidator.java for performance improvement.

> Performance improvement of DomainValidator by change the regular expression
> ---------------------------------------------------------------------------
>
>                 Key: VALIDATOR-252
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-252
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Routines
>    Affects Versions: 1.4
>         Environment: Windows 2000 Professional, Pentium4 2.4GHz, RAM:512M, Eclipse 3.3m Junit 3.8.1
>            Reporter: Makoto Uchino
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: DomainValidator.java.diff
>
>
> It seemed to take very long time to match the regular expression when long TLD (consists of around 30-characters over TLD) was specified for DomainValidator, this exponential performance will make it appear that the program has hung.
> The match time improves if it is possible to change DOMAIN_LABEL_REGEX from using (?:) to (?>), as follows.
> DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*"
> (All unit tests in DomainValidatorTest are succeed even if it changes as shown in the above-mentioned.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (VALIDATOR-252) Performance improvement of DomainValidator by change the regular expression

Posted by "Ben Speakmon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VALIDATOR-252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben Speakmon resolved VALIDATOR-252.
------------------------------------

    Resolution: Fixed
      Assignee: Ben Speakmon

Patch applied. Thanks!

$ svn ci -m "VALIDATOR-252: improve regex performance for DomainValidator"
Sending        src/main/java/org/apache/commons/validator/routines/DomainValidator.java
Transmitting file data .
Committed revision 600231.


> Performance improvement of DomainValidator by change the regular expression
> ---------------------------------------------------------------------------
>
>                 Key: VALIDATOR-252
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-252
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Routines
>    Affects Versions: 1.4
>         Environment: Windows 2000 Professional, Pentium4 2.4GHz, RAM:512M, Eclipse 3.3m Junit 3.8.1
>            Reporter: Makoto Uchino
>            Assignee: Ben Speakmon
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: DomainValidator.java.diff
>
>
> It seemed to take very long time to match the regular expression when long TLD (consists of around 30-characters over TLD) was specified for DomainValidator, this exponential performance will make it appear that the program has hung.
> The match time improves if it is possible to change DOMAIN_LABEL_REGEX from using (?:) to (?>), as follows.
> DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*"
> (All unit tests in DomainValidatorTest are succeed even if it changes as shown in the above-mentioned.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (VALIDATOR-252) Performance improvement of DomainValidator by change the regular expression

Posted by "Ben Speakmon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VALIDATOR-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546561 ] 

Ben Speakmon commented on VALIDATOR-252:
----------------------------------------

Looks right to me. Can you supply a full-fledged patch?

> Performance improvement of DomainValidator by change the regular expression
> ---------------------------------------------------------------------------
>
>                 Key: VALIDATOR-252
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-252
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Routines
>    Affects Versions: 1.4
>         Environment: Windows 2000 Professional, Pentium4 2.4GHz, RAM:512M, Eclipse 3.3m Junit 3.8.1
>            Reporter: Makoto Uchino
>            Priority: Minor
>             Fix For: 1.4
>
>
> It seemed to take very long time to match the regular expression when long TLD (consists of around 30-characters over TLD) was specified for DomainValidator, this exponential performance will make it appear that the program has hung.
> The match time improves if it is possible to change DOMAIN_LABEL_REGEX from using (?:) to (?>), as follows.
> DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*"
> (All unit tests in DomainValidatorTest are succeed even if it changes as shown in the above-mentioned.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.