You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "hu xiaodong (JIRA)" <ji...@apache.org> on 2017/06/09 08:57:19 UTC

[jira] [Created] (HADOOP-14513) A little performance improvement of HarFileSystem

hu xiaodong created HADOOP-14513:
------------------------------------

             Summary: A little performance improvement of HarFileSystem
                 Key: HADOOP-14513
                 URL: https://issues.apache.org/jira/browse/HADOOP-14513
             Project: Hadoop Common
          Issue Type: Improvement
            Reporter: hu xiaodong
            Assignee: hu xiaodong
            Priority: Trivial


In the Java source of HarFileSystem.java:
{code:title=HarFileSystem.java|borderStyle=solid}
...................
...................
private Path archivePath(Path p) {
    Path retPath = null;
    Path tmp = p;
    
    // I think p.depth() need not be loop many times, depth() is a complex calculation
    for (int i=0; i< p.depth(); i++) {
      if (tmp.toString().endsWith(".har")) {
        retPath = tmp;
        break;
      }
      tmp = tmp.getParent();
    }
    return retPath;
  }
...................
...................
{code}
 
I think the fellow is more suitable:
{code:title=HarFileSystem.java|borderStyle=solid}
...................
...................
private Path archivePath(Path p) {
    Path retPath = null;
    Path tmp = p;
    
    // just loop once
    for (int i=0,depth=p.depth(); i< depth; i++) {
      if (tmp.toString().endsWith(".har")) {
        retPath = tmp;
        break;
      }
      tmp = tmp.getParent();
    }
    return retPath;
  }
...................
...................
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org