You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Benjamin Francisoud (JIRA)" <ji...@apache.org> on 2008/02/12 17:41:08 UTC

[jira] Updated: (PIG-106) Improve use of StringBuffer in TestBuiltin.java to reduce memory footprint and increase speed

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

Benjamin Francisoud updated PIG-106:
------------------------------------

    Attachment: PIG-106-v01.patch

> Improve use of StringBuffer in TestBuiltin.java to reduce memory footprint and increase speed
> ---------------------------------------------------------------------------------------------
>
>                 Key: PIG-106
>                 URL: https://issues.apache.org/jira/browse/PIG-106
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: 0.1.0
>            Reporter: Benjamin Francisoud
>            Priority: Minor
>         Attachments: PIG-106-v01.patch
>
>
> While investigating PIG-99, in TestBuiltin.java line 315:
> {code:java}
> for (int i = 0; i < LOOP_COUNT; i++) {
>     for (int j = 0; j < LOOP_COUNT; j++) {
>         sb.append(i + "\t" + i + "\t" + j % 2 + "\n");
>     }
> }
> {code}
> doing "i + "\t" + i + "\t" + j % 2 + "\n"" creates temporary String(s) reducing the advantages of using a StringBuffer.
> Could be replace with:
> {code:java}
> for (int i = 0; i < LOOP_COUNT; i++) {
>     for (int j = 0; j < LOOP_COUNT; j++) {
>         sb.append(i);
>         sb.append("\t");
>         sb.append(i);
>         sb.append("\t");
>         sb.append(j % 2);
>         sb.append("\n");
>     }
> }
> {code}

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