You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2009/07/03 23:12:47 UTC

[jira] Created: (LANG-512) Compare performance of replace method to regex in Java

Compare performance of replace method to regex in Java
------------------------------------------------------

                 Key: LANG-512
                 URL: https://issues.apache.org/jira/browse/LANG-512
             Project: Commons Lang
          Issue Type: Sub-task
            Reporter: Henri Yandell
             Fix For: 3.0


Can we delete our replace methods?

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


[jira] Commented: (LANG-512) Compare performance of replace method to regex in Java

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730226#action_12730226 ] 

Henri Yandell commented on LANG-512:
------------------------------------

Completely missed that there's a literal based replace from JDK 1.5 onwards. Here are the stats when including java.lang.String.replace(CharSequence, CharSequence). Namely it sucks, at least on OS X.

Length: 19 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.018
REGX PERF: 0:00:00.066
JDK  PERF: 0:00:00.027


Length: 190 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.028
REGX PERF: 0:00:00.099
JDK  PERF: 0:00:00.097


Length: 1900 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.244
REGX PERF: 0:00:00.778
JDK  PERF: 0:00:00.796


Length: 19000 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:02.452
REGX PERF: 0:00:07.733
JDK  PERF: 0:00:07.687


Length: 17000 replacing length 17 with length 16, 5000 times. 
LANG PERF: 0:00:02.121
REGX PERF: 0:00:11.659
JDK  PERF: 0:00:11.741

> Compare performance of replace method to regex in Java
> ------------------------------------------------------
>
>                 Key: LANG-512
>                 URL: https://issues.apache.org/jira/browse/LANG-512
>             Project: Commons Lang
>          Issue Type: Sub-task
>            Reporter: Henri Yandell
>             Fix For: 3.0
>
>
> Can we delete our replace methods?

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


[jira] Closed: (LANG-512) Compare performance of replace method to regex in Java

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

Henri Yandell closed LANG-512.
------------------------------

    Resolution: Won't Fix

Closing as we're not going to remove our replacement code.

> Compare performance of replace method to regex in Java
> ------------------------------------------------------
>
>                 Key: LANG-512
>                 URL: https://issues.apache.org/jira/browse/LANG-512
>             Project: Commons Lang
>          Issue Type: Sub-task
>            Reporter: Henri Yandell
>             Fix For: 3.0
>
>
> Can we delete our replace methods?

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


[jira] Commented: (LANG-512) Compare performance of replace method to regex in Java

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12729956#action_12729956 ] 

Henri Yandell commented on LANG-512:
------------------------------------

Some basic tests. Lang's much quicker than using the JDK's Regex code for static text.


Length: 19 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.017
JDK  PERF: 0:00:00.063

Length: 190 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.056
JDK  PERF: 0:00:00.143

Length: 1900 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:00.260
JDK  PERF: 0:00:01.125

Length: 19000 replacing length 7 with length 6, 5000 times. 
LANG PERF: 0:00:02.364
JDK  PERF: 0:00:07.258

Length: 17000 replacing length 17 with length 16, 5000 times. 
LANG PERF: 0:00:02.028
JDK  PERF: 0:00:11.250


> Compare performance of replace method to regex in Java
> ------------------------------------------------------
>
>                 Key: LANG-512
>                 URL: https://issues.apache.org/jira/browse/LANG-512
>             Project: Commons Lang
>          Issue Type: Sub-task
>            Reporter: Henri Yandell
>             Fix For: 3.0
>
>
> Can we delete our replace methods?

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