You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2020/07/12 16:51:00 UTC

[jira] [Updated] (GROOVY-9637) Improve the performance of GString

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

Daniel Sun updated GROOVY-9637:
-------------------------------
    Description: 
{{GString}} will run {{toString()}} whenever its implementation needs its literal string, but unfortunately its literal string will be re-constructed for each time and the process costs quite a little of time.

So I propose to check whether {{GString}} values are all of immutable type, e.g. primitive types and their boxed type, {{String}}, etc. If yes,  use the cached literal string, otherwise re-construct the literal string.


  was:
{{GString}} will run {{toString()}} whenever its implementation needs its literal string, but unfortunately {{toString()}} will be re-constructed for each time and the process costs quite a little of time.

So I propose to check whether {{GString}} values are all of immutable type, e.g. primitive types and their boxed type, {{String}}, etc. If yes,  use the cached literal string, otherwise re-constructe the literal string.



> Improve the performance of GString
> ----------------------------------
>
>                 Key: GROOVY-9637
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9637
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{GString}} will run {{toString()}} whenever its implementation needs its literal string, but unfortunately its literal string will be re-constructed for each time and the process costs quite a little of time.
> So I propose to check whether {{GString}} values are all of immutable type, e.g. primitive types and their boxed type, {{String}}, etc. If yes,  use the cached literal string, otherwise re-construct the literal string.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)