You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Eric Jablow (JIRA)" <ji...@apache.org> on 2009/12/02 01:22:20 UTC

[jira] Created: (HUPA-58) Strings concatenated in loops

Strings concatenated in loops
-----------------------------

                 Key: HUPA-58
                 URL: https://issues.apache.org/jira/browse/HUPA-58
             Project: JAMES Hupa
          Issue Type: Improvement
            Reporter: Eric Jablow
            Assignee: Norman Maurer
            Priority: Minor
         Attachments: concatenation-in-loop.patch

A few Java files have code like

String ret = "";
for (String s : ...) {
  ret += s +" ";
}

StringBuilder.append() is faster and does not allocate new objects.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Assigned: (HUPA-58) Strings concatenated in loops

Posted by "Manuel Carrasco Moñino (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HUPA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manuel Carrasco Moñino reassigned HUPA-58:
------------------------------------------

    Assignee: Manuel Carrasco Moñino  (was: Norman Maurer)

> Strings concatenated in loops
> -----------------------------
>
>                 Key: HUPA-58
>                 URL: https://issues.apache.org/jira/browse/HUPA-58
>             Project: JAMES Hupa
>          Issue Type: Improvement
>            Reporter: Eric Jablow
>            Assignee: Manuel Carrasco Moñino
>            Priority: Minor
>         Attachments: concatenation-in-loop.patch
>
>   Original Estimate: 0.17h
>  Remaining Estimate: 0.17h
>
> A few Java files have code like
> String ret = "";
> for (String s : ...) {
>   ret += s +" ";
> }
> StringBuilder.append() is faster and does not allocate new objects.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Resolved: (HUPA-58) Strings concatenated in loops

Posted by "Manuel Carrasco Moñino (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HUPA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manuel Carrasco Moñino resolved HUPA-58.
----------------------------------------

    Resolution: Fixed

Partially applied in trunk
I've applied your patch only to server classes, after fixing some lines which break tests.
In shared classes, code is going to be compiled into javascript, and I think the patch doesnt worth it because the '+' operator in javascript works different than in java, and '+' is easier to handle by gwt compiler.

> Strings concatenated in loops
> -----------------------------
>
>                 Key: HUPA-58
>                 URL: https://issues.apache.org/jira/browse/HUPA-58
>             Project: JAMES Hupa
>          Issue Type: Improvement
>            Reporter: Eric Jablow
>            Assignee: Manuel Carrasco Moñino
>            Priority: Minor
>         Attachments: concatenation-in-loop.patch
>
>   Original Estimate: 0.17h
>  Remaining Estimate: 0.17h
>
> A few Java files have code like
> String ret = "";
> for (String s : ...) {
>   ret += s +" ";
> }
> StringBuilder.append() is faster and does not allocate new objects.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Updated: (HUPA-58) Strings concatenated in loops

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

Eric Jablow updated HUPA-58:
----------------------------

    Attachment: concatenation-in-loop.patch

Patch to replace String concatenation in loops with StringBuilder.append calls.  I suggest using Google Collections' Joiner class instead.

> Strings concatenated in loops
> -----------------------------
>
>                 Key: HUPA-58
>                 URL: https://issues.apache.org/jira/browse/HUPA-58
>             Project: JAMES Hupa
>          Issue Type: Improvement
>            Reporter: Eric Jablow
>            Assignee: Norman Maurer
>            Priority: Minor
>         Attachments: concatenation-in-loop.patch
>
>   Original Estimate: 0.17h
>  Remaining Estimate: 0.17h
>
> A few Java files have code like
> String ret = "";
> for (String s : ...) {
>   ret += s +" ";
> }
> StringBuilder.append() is faster and does not allocate new objects.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org