[ 
https://issues.apache.org/jira/browse/GROOVY-7873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15348982#comment-15348982
 ] 

ASF GitHub Bot commented on GROOVY-7873:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/356

    GROOVY-7873 - Regression performance issue in string methods

    In order to implement CharSequence the GString implementation must call 
toString each time a CharSequence method is invoked.  This is expensive, so 
GStrings should be converted toString if methods such as charAt are going to be 
called from a loop.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy GROOVY-7873

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/356.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #356
    
----
commit 1019df6be01b1898312797534ccc8406fd4f4fad
Author: John Wagenleitner <jwagenleit...@apache.org>
Date:   2016-06-25T01:08:57Z

    GROOVY-7873 - Regression performance issue in string methods
    
    In order to implement CharSequence the GString implementation must call 
toString each time a CharSequence method is invoked.  This is expensive, so 
GStrings should be converted toString if methods such as charAt are going to be 
called from a loop.

commit 720115d7444d758f0c057ec8d47772d2ffb81154
Author: John Wagenleitner <jwagenleit...@apache.org>
Date:   2016-06-25T01:09:45Z

    GROOVY-7873 - test for demo purposes, not to be merged

----


> Regression performance issue in string methods
> ----------------------------------------------
>
>                 Key: GROOVY-7873
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7873
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: Tadas Krivickas
>            Priority: Critical
>         Attachments: test.groovy
>
>
> Starting with 2.4.7, performance in string processing (in certain scenarios) 
> has decreased dramatically. Specifically, it happens when using 
> {{stripMargin()}} on a {{GString}} that has a variable substitution with a 
> huge String value. In our app performance decrease was from tens of 
> miliseconds to 1+ minute. 
> I suspect the latest refactoring in string methods.
> Attaching a test case.
> {code}
> R2D2:groovystrperf tadaskay$ /usr/local/Cellar/groovy/2.4.7/bin/groovy 
> test.groovy
> Took 1456 ms
> R2D2:groovystrperf tadaskay$ /usr/local/Cellar/groovy/2.4.5/bin/groovy 
> test.groovy
> Took 43 ms
> {code}



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

Reply via email to