[ 
https://issues.apache.org/jira/browse/HDFS-1774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13067198#comment-13067198
 ] 

Uma Maheswara Rao G commented on HDFS-1774:
-------------------------------------------

Hi Eli,
I am little bit confusing with the question :-(

You are talking about this line?
{code}
  if (dirList.size() > 0) {
+          children = dirList.toArray(new FSDir[dirList.size()]);
         }
{code}

if i am not wrong: this is because i can not assign directly list to array 
right?


Since i can not guess the children size, i have chosen list initially to 
collect the elements.

please correct me if i understood wrongly

> Small optimization in org.apache.hadoop.hdfs.server.datanode.FSDataset class.
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-1774
>                 URL: https://issues.apache.org/jira/browse/HDFS-1774
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: data-node
>            Reporter: Uma Maheswara Rao G
>            Assignee: Uma Maheswara Rao G
>             Fix For: 0.23.0
>
>         Attachments: HDFS-1774-1.patch, HDFS-1774-1.patch, HDFS-1774.patch
>
>
>  Inner class FSDir constructor is doing duplicate iterations over the listed 
> files in the passed directory. We can optimize this to single loop and also 
> we can avoid isDirectory check which will perform some native invocations. 
>   Consider a case: one directory has only one child directory and 10000 
> files. 
> 1) First loop will get the number of children directories.
> 2) if (numChildren > 0) , This condition will satisfy and again it will 
> iterate 10001 times and also will check isDirectory.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to