[ 
https://issues.apache.org/jira/browse/NET-455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb resolved NET-455.
----------------------

    Resolution: Not A Problem

Thanks for confirming that it is not a problem in NET
                
> FTPClient listFiles(FTPFileFilter) can be faster...
> ---------------------------------------------------
>
>                 Key: NET-455
>                 URL: https://issues.apache.org/jira/browse/NET-455
>             Project: Commons Net
>          Issue Type: Improvement
>          Components: FTP
>    Affects Versions: 3.0.1
>         Environment: all
>            Reporter: Nicolas
>            Priority: Minor
>              Labels: ftpclient, listFiles
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I tested two ways of sorting files on a remote FTP server with many files ( > 
> 110 000). Both of these use the FtpFileFilter class (with a test on the 
> extension filename... very simple).
> The first one is the conventionnal => 
> {code}
> files = ftpClient.listFiles("./", ftpFileFilter);
> {code}
> It takes about 90 seconds ...
> the second one is ... nearly as simple as the first one : 
> {code}
> FTPFile []  allFilesListed = ftpClient.listFiles();
> files = FTPFileFilterWithExtension.fastFilter(ftpFileFilter, allFilesListed);
> {code}
> The function FTPFileFilterWithExtension.fastFilter() call the same 
> ftpFileFilter :
> {code}
> public static FTPFile [] fastFilter(FTPFileFilter filter, FTPFile 
> ftpFileArray []) {
>     ArrayList<FTPFile> listOfFTPFiles = new ArrayList<FTPFile>();
>     for (FTPFile ftpf : ftpFileArray) {
>         boolean accepted = filter.accept(ftpf);
>         if (accepted) {
>             listOfFTPFiles.add(ftpf);
>         }
>     }
>     FTPFile resultArray [] = new FTPFile[listOfFTPFiles.size()];
>     return listOfFTPFiles.toArray(resultArray);
> }
> {code}
> The second method is EIGHT times faster than the first one ... and I don't 
> really understand why...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to