[
https://issues.apache.org/jira/browse/HIVE-5019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13736241#comment-13736241
]
Benjamin Jakobus commented on HIVE-5019:
----------------------------------------
Yes Navis - you're right. It should be StringBuilder. StringBuffer is
synchronized.
Yes, they do mostly replace + with StringBuilder.append(). However this is not
always the case it seems. I ran some tests and they showed that using the
StringBuilder when appending strings is 57% faster than using the + operator
(using the StringBuffer took 122 milliseconds whilst the + operator took 284
milliseconds).
Bt yes, since + gets translated building complex strings inside loops will
require many (unnecessary) instantiations (and as discussed in 5009, creating
new objects inside loops is inefficient).
> Use StringBuffer instead of += (issue 1)
> ----------------------------------------
>
> Key: HIVE-5019
> URL: https://issues.apache.org/jira/browse/HIVE-5019
> Project: Hive
> Issue Type: Sub-task
> Reporter: Benjamin Jakobus
> Assignee: Benjamin Jakobus
> Fix For: 0.12.0
>
> Attachments: HIVE-5019.1.patch.txt, HIVE-5019.2.patch.txt
>
>
> Issue 1 (use of StringBuffer over +=)
> java/org/apache/hadoop/hive/ql/optimizer/physical/GenMRSkewJoinProcessor.java
> java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
> java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java
> java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
> java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
> java/org/apache/hadoop/hive/ql/plan/ConditionalResolverMergeFiles.java
> java/org/apache/hadoop/hive/ql/plan/PlanUtils.java
> java/org/apache/hadoop/hive/ql/security/authorization/BitSetCheckedAuthorizationProvider.java
> java/org/apache/hadoop/hive/ql/stats/jdbc/JDBCStatsUtils.java
> java/org/apache/hadoop/hive/ql/udf/UDFLike.java
> java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSentences.java
> java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
> java/org/apache/hadoop/hive/ql/udf/ptf/NPath.java
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira