skyguard1 commented on a change in pull request #3562:
URL: https://github.com/apache/hbase/pull/3562#discussion_r684169439
##########
File path:
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyJob.java
##########
@@ -331,12 +331,12 @@ protected Path createInputFileListing(Job job) throws
IOException {
private Text getKey(Path path) {
int level = conf.getInt(NUMBER_OF_LEVELS_TO_PRESERVE_KEY, 1);
int count = 0;
- String relPath = "";
+ StringBuilder relPath = new StringBuilder();
Review comment:
But the length of `path.getName()` is not fixed, how to determine the
initial capacity?
Unless the Path is traversed again and the length of the name is calculated,
the performance will obviously not improve. Splicing strings in a loop will
generate a new string each time. In my opinion, using `StringBuilder` will
improve performance, thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]