[
https://issues.apache.org/jira/browse/SQOOP-2906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15237026#comment-15237026
]
ASF GitHub Bot commented on SQOOP-2906:
---------------------------------------
Github user JoeriHermans commented on the pull request:
https://github.com/apache/sqoop/pull/18#issuecomment-208859666
@stanleyxu2005 The main difference in my implementation is that I only have
to do a single copy. StringBuilders are inefficient, char arrays are a lot
faster since everything is pre-allocated already. Furthermore, the overhead
over constantly allocating a new object, and the fact that internally the
StringBuilder will do some copying as well, make this an inefficient approach.
For example, I implemented your approach and instead of a 500% improvement
with our method, I have a 230% increase in performance with the StringBuilder
approach. So the char-array is definitely a lot faster, and this is what it is
all about, since this is a very prominent function on the stack.
Kind regards,
Joeri
> Optimization of AvroUtil.toAvroIdentifier
> -----------------------------------------
>
> Key: SQOOP-2906
> URL: https://issues.apache.org/jira/browse/SQOOP-2906
> Project: Sqoop
> Issue Type: Improvement
> Reporter: Joeri Hermans
> Labels: avro, hadoop, optimization
>
> Hi all
> Our distributed profiler indicated some inefficiencies in the
> AvroUtil.toAvroIdentifier method, more specifically, the use of Regex
> patterns. This can be directly observed from the FlameGraph generated by this
> profiler (https://jhermans.web.cern.ch/jhermans/sqoop_avro_flamegraph.svg).
> We implemented an optimization, and compared this with the original method.
> On our testing machine, the optimization by itself is about 500% (on average)
> more efficient compared to the original implementation. We have yet to test
> how this optimization will influence the performance of user jobs.
> Any suggestions or remarks are welcome.
> Kind regards,
> Joeri
> https://github.com/apache/sqoop/pull/18
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)