hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olga Natkovich (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-106) Optimize Pig by replacing String '+' and StringBuffer with StringBuilder
Date Fri, 29 Feb 2008 23:53:51 GMT

    [ https://issues.apache.org/jira/browse/PIG-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574013#action_12574013
] 

Olga Natkovich commented on PIG-106:
------------------------------------

I tried to apply the patch to the latest trunk and got failures. Also, as I was looking at
the failures, some of the changes specifically in Tuple.java go beyond just String Builder.
For instance, it adds if-else construct into the getField call. We don't want to do that -
we don't want an extra branch on the critical path.

Could you regenerate the patch with just changes to to string formatting, thanks.

> Optimize Pig by replacing String '+' and StringBuffer with StringBuilder
> ------------------------------------------------------------------------
>
>                 Key: PIG-106
>                 URL: https://issues.apache.org/jira/browse/PIG-106
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.1.0
>            Reporter: Benjamin Francisoud
>            Assignee: Benjamin Francisoud
>         Attachments: PIG-106-v01.patch, PIG-106-v02.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.


Mime
View raw message