You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Stefan Groschupf <sg...@media-style.com> on 2005/10/11 13:46:55 UTC

to many hdd reads

Hi,
don't think I'm fuddy-duddy but is it really sensefull to do following 
in the nutchbean?

File [] directories = fs.listFiles(indexesDir);
      for(int i = 0; i < fs.listFiles(indexesDir).length; i++) {

wouldn't it be better to do it like this:
File [] directories = fs.listFiles(indexesDir);
      for(int i = 0; i < directories.length; i++) {

First of all that are many unneccesary disck reads and second there is 
theoretically a chance that the numbers of files change until the loop 
and this will throw an exception.

Should I provide a patch or someone of the contributor just change this 
one word?

Thanks!
Stefan

Re: to many hdd reads

Posted by Piotr Kosiorowski <pk...@gmail.com>.
Committed in trunk and branch-0.7 (just in case if we decide to make a
0.7.2release sometime).
Thanks
Piotr

On 10/11/05, Stefan Groschupf <sg...@media-style.com> wrote:
>
> Hi,
> don't think I'm fuddy-duddy but is it really sensefull to do following
> in the nutchbean?
>
> File [] directories = fs.listFiles(indexesDir);
> for(int i = 0; i < fs.listFiles(indexesDir).length; i++) {
>
> wouldn't it be better to do it like this:
> File [] directories = fs.listFiles(indexesDir);
> for(int i = 0; i < directories.length; i++) {
>
> First of all that are many unneccesary disck reads and second there is
> theoretically a chance that the numbers of files change until the loop
> and this will throw an exception.
>
> Should I provide a patch or someone of the contributor just change this
> one word?
>
> Thanks!
> Stefan
>